Ah, yes. I see your point. Apologies to all for the misinformation. --Gray
On 12 Mar 2006 19:31:18 +0100, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > "Gray Calhoun" <[EMAIL PROTECTED]> writes: > > > Tolga, > > > > Look at numericDeriv. > > > > > arbfun <- function(x) x^2 > > > x <- 3 > > > numericDeriv(quote(arbfun(x)), "x") > > [1] 9 > > attr(,"gradient") > > [,1] > > [1,] 6 > > However, numericDeriv is not particularly intelligent. It is > effectively doing what Tolga was trying not to. A more refined > function could be a good idea, e.g. implementing higher order > approximations, a tunable stepsize, box constraints... > > > --Gray > > > > On 3/12/06, Tolga Uzuner <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > Suppose I have an arbitrary function: > > > > > > arbfun<-function(x) {...} > > > > > > Is there a robust implementation of a numerical derivative routine in R > > > which I can use to take it's derivative ? Something a bit more than > > > simple division by delta of the difference of evaluating the function at > > > x and x+delta... > > > > > > Perhaps there is a way to do this using D or deriv but I could not > > > figure it out. Trying: > > > > > > eval(deriv(function(x) arbfun(x),"x"),1) > > > > > > does not seem to work. > > > > > > Thanks, > > > Tolga > > > > > > ______________________________________________ > > > 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 > > > > > > > > > -- > > Gray Calhoun > > > > Economics Department > > UC San Diego > > > > ______________________________________________ > > 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 > > > > -- > O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B > c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K > (*) \(*) -- 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 > -- Gray Calhoun Economics Department UC San Diego ______________________________________________ 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