Closed noahaskell closed 11 years ago
You mean basically the CDF for multivariate normal?
Thanks for the citations. We could code the algorithm in the Genz paper directly in templated C++ and that would work. It would be much more efficient if we could calculate partial derivatives w.r.t. inputs efficiently.
I'm guessing these may have well-understood forms, but Ben or Marcus or Andrew will know.
Having a functional program to work from is always a plus.
(Speaking of integration, we also need the inverse CDFs.)
On 7/22/13 1:32 PM, noahmotion wrote:
I am (formally) requesting that a multivariate normal integral function be added to Stan. I don't see such a function in the to-do list, and I couldn't find anything about it in the issue report/feature request log, but it would be very useful to have.
For what it's worth, Alan Genz has (from what I can tell) good Fortran code for calculating multivariate normal integrals (I don't know how easy it would be to adapt Fortran code for use in Stan, but I thought I'd at least attempt to be as helpful as I could when asking for a feature like this):
http://www.math.wsu.edu/faculty/genz/software/fort77/mvndstpack.f http://www.math.wsu.edu/faculty/genz/software/fort77/mvnpack.f
The numerical method he developed to calculate multivariate normal and t integrals is described in these papers:
http://www.math.wsu.edu/faculty/genz/papers/mvn.pdf http://www.math.wsu.edu/faculty/genz/papers/bvnt.pdf
He also has an R package called mvtnorm.
Thanks!
— Reply to this email directly or view it on GitHub https://github.com/stan-dev/stan/issues/158.
Thanks for the quick response, and yes, I meant the CDF for the multivariate normal density. I'm not sure about the partial derivatives or inverse CDFs, unfortunately, but maybe the papers I linked to will be helpful on those fronts?
I just remembered that Tom Wickens' gives the partial derivatives for the bivariate Gaussian CDF in his 1992 J. of Math. Psych. paper (the broader point of which is to describe the Newton-Raphson algorithm for maximum likelihood estimation of the parameters in a multidimensional signal detection/probit model):
http://www.sciencedirect.com/science/article/pii/0022249692900378
Moved to to-do list with notes.
I am (formally) requesting that a multivariate normal integral function be added to Stan. I don't see such a function in the to-do list, and I couldn't find anything about it in the issue report/feature request log, but it would be very useful to have.
For what it's worth, Alan Genz has (from what I can tell) good Fortran code for calculating multivariate normal integrals (I don't know how easy it would be to adapt Fortran code for use in Stan, but I thought I'd at least attempt to be as helpful as I could when asking for a feature like this):
http://www.math.wsu.edu/faculty/genz/software/fort77/mvndstpack.f http://www.math.wsu.edu/faculty/genz/software/fort77/mvnpack.f
The numerical method he developed to calculate multivariate normal and t integrals is described in these papers:
http://www.math.wsu.edu/faculty/genz/papers/mvn.pdf http://www.math.wsu.edu/faculty/genz/papers/bvnt.pdf
He also has an R package called mvtnorm.
Thanks!