Page 1 of 1
One-sided accurate numeric derivatives
Posted: Tue Aug 24, 2010 1:18 am
by maxchen
Should it be "One-sided fast numeric derivatives"?
Code: Select all
!N = 1000
wfcreate(page=gm) u 1 !N
rndseed(type=mt) 12357
coef b = 1
coef r = 2
genr y = @rgamma(b(1),r(1)) 'random of Gamma dist
logl L_g
L_g.append @logl L
L_g.append L = @log( @dgamma(y,b(1),r(1)) )
L_g.append @derivstep(1) @all 1.49e-8 1e-10
L_g.append @param b(1) 0.05 r(1) 2
freeze(tb0) L_g.ml(showopts)
freeze(tb1) L_g.checkderivs
Then check the top of tb1, "One-sided accurate numeric derivatives". I think one-sided for speed, and two-sided for accuracy.
Re: One-sided accurate numeric derivatives
Posted: Tue Aug 24, 2010 4:25 am
by trubador
The default is "numeric derivatives" in LogL object. You can control the "Accuracy" and "Speed" for both "Analytical" and "Numerical" derivatives. Therefore, although "One-sided accurate numeric derivatives" are faster than that of "Two-sided accurate numeric derivatives", it is not "One-sided fast numeric derivatives", which requires explicit specification of "Speed" as the method of taking derivatives.
Re: One-sided accurate numeric derivatives
Posted: Tue Aug 24, 2010 9:08 am
by EViews Glenn
To elaborate on Trubador's response. The fast numeric derivatives are simple two point (two-sided) evaluations. The accurate numeric derivatives are RIchardson derivatives which evaluate at four points. Note that EViews does not compute one-sided numeric derivatives.
One last comment. The fast/accurate distinction when using analytic derivatives is only relevant for those terms for which we cannot determine the analytic expression for the derivative.
Re: One-sided accurate numeric derivatives
Posted: Wed Aug 25, 2010 5:08 am
by maxchen
hmm, but [f(x+h)-f(x)]/h is called one-sided, and [f(x+h)-f(x-h)]/(2h) is called two-sided
Re: One-sided accurate numeric derivatives
Posted: Wed Aug 25, 2010 9:23 am
by EViews Glenn
That is correct and does not contradict anything that I wrote. EViews only does two-sided or Richardson numeric derivatives. The two-sided are the fast and the Richardson are the accurate.