[R] The gradient of a multivariate normal density with respecttoits parameters
Ravi Varadhan
RVaradhan at jhmi.edu
Wed Jun 24 17:28:08 CEST 2009
Karl,
I have written a function to compute the gradient of a multivariate normal
density (derivatives at a given point, with respect to the parameters of the
density). It is in the atttached file. I would appreciate any feedback.
There are couple of interesting points:
1. Note is that there is a minor adjustment needed to the formulas given by
Dwyer (Table 2, Eqs. (11.7 and 11.8) to account for the symmetry in the
derivatives of the covariance parameters. Without this adjustment the
derivatives of covariances are off by a factor of 2.
2. I couldn't figure out how to avoid inverting the covariance matrix for
Eq. (11.7), using `solve(sigma)'. I would appreciate knowing if there is a
trick for doing this.
Ravi.
----------------------------------------------------------------------------
-------
Ravi Varadhan, Ph.D.
Assistant Professor, The Center on Aging and Health
Division of Geriatric Medicine and Gerontology
Johns Hopkins University
Ph: (410) 502-2619
Fax: (410) 614-9625
Email: rvaradhan at jhmi.edu
Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml
----------------------------------------------------------------------------
--------
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Karl Ove Hufthammer
Sent: Wednesday, June 24, 2009 3:21 AM
To: r-help at stat.math.ethz.ch
Subject: Re: [R] The gradient of a multivariate normal density with
respecttoits parameters
Ravi Varadhan:
> You may want to look at the paper by Dwyer on "Some applications of
> matrix derivatives in multivariate analysis" (JASA 1967), especially
> the Table 2 on p. 617.
Thanks! That's a *very* useful paper. Note there also is a small corrigenda
available:
Corrigenda: Some Applications of Matrix Derivatives in Multivariate Analysis
Paul S. Dwyer Journal of the American Statistical Association, Vol. 62, No.
320 (Dec., 1967), p. 1518 Stable URL: http://www.jstor.org/stable/2283811
--
Karl Ove Hufthammer
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mvnorm_grad.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090624/f4aa0733/attachment-0002.txt>
More information about the R-help
mailing list