"Uzuner, Tolga" <[EMAIL PROTECTED]> writes: > Ah... I searched for half an hour for this function... you know, the > help function in R could really be a lot better... > > But wait a minute... looking at this, it appears you have to pass in > an expression. What if it is an unknown function, where you only > have a handle to the function, but you cannot see it's > implementation ? Will this work then ? > > -----Original Message----- > From: Berton Gunter [mailto:[EMAIL PROTECTED] > Sent: 05 May 2005 23:34 > To: 'Uzuner, Tolga'; r-help@stat.math.ethz.ch > Subject: RE: [R] Numerical Derivative / Numerical Differentiation of > unknown funct ion > > > But... > > See ?numericDeriv which already does it via a C call and hence is much > faster (and probably more accurate,too). >
The expression passed to numericDeriv can easily be a call to .C or similar. Actually, numericDeriv can get you in trouble if the function is not smooth enough. It basically just calculates (f(a+d)-f(a))/d where d is on the order of 1e-7 * a for each parameter. Sometimes a larger d and a higher order approximation is need to avoid getting stuck in the rough. (Yes, Bill, I do remember that you wanted an R News Programmer's Niche item from me on this...) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html