statsmodels.sandbox.distributions.extras.mvstdnormcdf

statsmodels.sandbox.distributions.extras.mvstdnormcdf(lower, upper, corrcoef, **kwds)[source]

standardized multivariate normal cumulative distribution function

This is a wrapper for scipy.stats._mvn.mvndst which calculates a rectangular integral over a standardized multivariate normal distribution.

This function assumes standardized scale, that is the variance in each dimension is one, but correlation can be arbitrary, covariance = correlation matrix

Parameters
lower, upperarray_like, 1d

lower and upper integration limits with length equal to the number of dimensions of the multivariate normal distribution. It can contain -np.inf or np.inf for open integration intervals

corrcoeffloat or array_like

specifies correlation matrix in one of three ways, see notes

optional keyword parameters to influence integration
  • maxptsint, maximum number of function values allowed. This

    parameter can be used to limit the time. A sensible strategy is to start with maxpts = 1000*N, and then increase maxpts if ERROR is too large.

  • abseps : float absolute error tolerance.

  • releps : float relative error tolerance.

Returns
cdfvaluefloat

value of the integral

See also

mvnormcdf

cdf of multivariate normal distribution without standardization

Notes

The correlation matrix corrcoef can be given in 3 different ways If the multivariate normal is two-dimensional than only the correlation coefficient needs to be provided. For general dimension the correlation matrix can be provided either as a one-dimensional array of the upper triangular correlation coefficients stacked by rows, or as full square correlation matrix

Examples

>>> print(mvstdnormcdf([-np.inf,-np.inf], [0.0,np.inf], 0.5))
0.5
>>> corr = [[1.0, 0, 0.5],[0,1,0],[0.5,0,1]]
>>> print(mvstdnormcdf([-np.inf,-np.inf,-100.0], [0.0,0.0,0.0], corr, abseps=1e-6))
0.166666399198
>>> print(mvstdnormcdf([-np.inf,-np.inf,-100.0],[0.0,0.0,0.0],corr, abseps=1e-8))
something wrong completion with ERROR > EPS and MAXPTS function values used;
                    increase MAXPTS to decrease ERROR; 1.048330348e-006
0.166666546218
>>> print(mvstdnormcdf([-np.inf,-np.inf,-100.0],[0.0,0.0,0.0], corr,                             maxpts=100000, abseps=1e-8))
0.166666588293