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

Uncorrelated variables

// Upper limits of integration
x = { 0, 0 };

/*
** Identity matrix, indicates
** zero correlation between variables
*/
corr = { 1 0,
         0 1 };

/*
** Calculate cumulative probability of
** both variables being ≤ 0
*/
p = cdfmvn(x, corr);

/*
** Calculate joint probablity of two
** variables with zero correlation,
** both, being ≤ 0
*/
p2 = cdfn(0) .* cdfn(0);

After the above code, both p and p2 should be equal to 0.25.

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 :

\[\Phi = P(-\infty < X_1 \leq -0.5, - \infty < X_2 \leq 1) \approx 0.28025\]

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:

\[\begin{split}P(x_1 \leq -1 \text{ and } x_2 \leq -1.1) = 0.0407\\ P(x_1 \leq +0 \text{ and } x_2 \leq +0.1) = 0.3198\\ P(x_1 \leq 1 \text{ and } x_2 \leq 1.1) = 0.7464\end{split}\]

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 that cdfMvne() takes a row vector of upper limits whereas cdfMvn() takes a column vector of limits.

See also

Functions cdfBvn(), cdfN(), lncdfmvn()