Reputation: 295
I was using the function mvn.mvnun()
in the scipy.stats
module to calculate the CDF of a given multivariate normal distribution in my paper. The reviewer asked me how I estimated the CDF since the CDF has no closed-form. I guess a sampling method might be used. To find out how it works, I searched the scipy
source code repo. However, in the scipy.stats
folder, I didn't see mvn.py
, I saw mvn.pyf
instead.
In the file, mvn.mvnun
seems to be defined as follows,
! -*- f90 -*-
! Note: the context of this file is case sensitive.
python module mvn ! in
interface ! in :mvn
subroutine mvnun(d,n,lower,upper,means,covar,maxpts,abseps,releps,value,inform) ! in :mvn:mvndst.f
integer intent(hide) :: d=shape(means,0)
integer intent(hide) :: n=shape(means,1)
double precision dimension(d) :: lower
double precision dimension(d) :: upper
double precision dimension(d,n) :: means
double precision dimension(d,d) :: covar
integer intent(optional) :: maxpts=d*1000
double precision intent(optional) :: abseps=1e-6
double precision intent(optional) :: releps=1e-6
double precision intent(out) :: value
integer intent(out) :: inform
end subroutine mvnun
However, there is no detailed definition of that function. I was wondering where I can find the source code for mvnun
that informs me how it calculates the CDF?
Upvotes: 3
Views: 2738
Reputation: 181
People using these routines from Alan Genz should reference and look at his papers for more information. This seems to be the one behind mvnun. https://doi.org/10.2307/1390838 As of 2023, avalable here: https://www.math.wsu.edu/faculty/genz/papers/mvn.pdf
Upvotes: 0
Reputation: 114841
The implementation is written in Fortran. That pyf
file defines the interface for the Fortran function in mvndst.f
Upvotes: 5