cdfMvn#
Purpose#
Computes multivariate Normal cumulative distribution function.
Format#
- p = cdfMvn(x, corr)#
- Parameters:
x (Kx1 vector or KxN matrix) – Values at which to evaluate the multivariate normal cumulative distribution function. If x has more than one column, each column will be treated as a separate set of upper limits.
corr (KxK matrix) – correlation matrix.
- Returns:
p (Nx1 vector) – Each element in p is the cumulative distribution function of the multivariate Normal distribution for each corresponding columns in x. p will have as many elements as the input, x, has columns.
Examples#
Example 2#
// Upper limits of integration
x = { -0.5, 1 };
// Correlation matrix
corr = { 1 0.26,
0.26 1 };
/*
** Calculate cumulative probability of
** the first variable being ≤ -0.5
** and the second variable being ≤ 1
*/
p = cdfmvn(x, corr);
After the above code, p should equal: 0.28025. It means :
when the correlation between two variables is 0.26.
Compute the cdf at 3 separate pairs of points#
/*
** Upper limits of integration
** x1 ≤ -1 and x2 ≤ -1.1
** x1 ≤ 0 and x2 ≤ 0.1
** x1 ≤ 1 and x2 ≤ 1.1
*/
x = { -1 0 1,
-1.1 0.1 1.1 };
// Correlation matrix
corr = { 1 0.31,
0.31 1 };
/*
** Calculate cumulative probability of
** each pair of upper limits
*/
p = cdfmvn(x, corr);
After the above code, p should equal:
0.040741382 0.31981965 0.74642007
which means that:
Remarks#
cdfMvn()evaluates the MVN integral with i-th row of \(x\) (upper limits), where \(1\leqslant i \leqslant N\)The correlation matrix \(R\) is defined by \(\Sigma = DRD\), where \(D\) denotes the diagonal matrix which has the square roots of the diagonal entries for covariance matrix \(\Sigma\) on its diagonal.
cdfMvne()is more accurate and faster. Note thatcdfMvne()takes a row vector of upper limits whereascdfMvn()takes a column vector of limits.
See also
Functions cdfBvn(), cdfN(), lncdfmvn()