[R] Numerical Derivatives in R
Tolga Uzuner
tolga at coubros.com
Sun Mar 12 19:00:35 CET 2006
Thanks Gray,
Tolga
Gray Calhoun wrote:
>Tolga,
>
>Look at numericDeriv.
>
>
>
>>arbfun <- function(x) x^2
>>x <- 3
>>numericDeriv(quote(arbfun(x)), "x")
>>
>>
>[1] 9
>attr(,"gradient")
> [,1]
>[1,] 6
>
>--Gray
>
>On 3/12/06, Tolga Uzuner <tolga at coubros.com> 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 at 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
>
>
>
More information about the R-help
mailing list