[R] Partial derivatives of a matrix with respect to a single element
Ron E. VanNimwegen
vanron at ksu.edu
Thu Nov 23 18:08:18 CET 2006
UseRs,
We are using projection matrices in demographic analyses, and one
technique is to calculate partial derivatives of a matrix with respect
to a variable appearing in one or more of its elements. For example,
consider the matrix A:
| a*b a*c |
| d d |
If I'm not mistaken, the partial derivative of matrix A w/ respect to
variable 'a' is the matrix:
| b c |
| 0 0 |
... just an element by element first order derivative of the notation,
but would like to use R in a manner similar to our method:
We are doing this with symbolic notation, variable assignments,
substitution, and the 'diff(matrix,variable)' function in Matlab;
however, I'm always looking for GNU solutions to old procedure$, if you
get my drift. I've read and used the derivative functions in R, and
could (probably) write a lengthy routine to duplicate this solution, but
if there's a shortcut, I have no delusions about my own laziness and
will greatly appreciate your input.
R. VanNimwegen
Kansas State University
Division of Biology
vanron at ksu.edu
More information about the R-help
mailing list