[Rd] symbollic differentiation in R

From: Andrew Clausen <clausen_at_econ.upenn.edu>
Date: Sun, 13 May 2007 13:22:41 -0400

Hi all,

I wrote a symbollic differentiation function in R, which can be downloaded here:


It is just a prototype. Of course, R already contains two differentiation functions: D and deriv. However, these functions have several limitations. They can probably be fixed, but since they are written in C, this would require a lot of work. Limitations include:

I think these limitations are fairly important. As it stands, it's rather difficult to automatically differentiate a likelihood function. Ideally, I would like to be able to write

        ll <- function(mean, sd)
                -sum(log(dnorm(x, mean, sd)))

        ll.deriv <- Deriv.function(ll)

I can't get this to work with my code since:

The above code would work right now if there were one parameter (so sum doesn't screw it up) and one scalar data point "x".

Is there an existing way of doing this that is close to being this convenient? Is it really much easier to solve the limitations I listed with a fresh R implementation?


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 13 May 2007 - 17:27:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 13 May 2007 - 19:33:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.