Dataplot Vol 2 Vol 1

# MULTIVARIATE NORMAL CDF

Name:
MULTIVARIATE NORMAL CDF
Type:
Let Subcommand
Purpose:
Compute the cumulative distribution function (CDF) from a multivariate normal distribution.
Description:
The NORCDF function computes the CDF of a univariate normal distribution. This command extends that capability to the multivariate case (for up to 20 variables).

The CDF is the integral of the probability density function from negative infinity to the desired value. In addition to the CDF case, this command can handle integration from the specified point to positive infinity and integration from negative infinity to positive infinity.

For the multivariate case, you need to specify a varible containing the location estimates for each variable, the variance-covariance matrix of the the variables, and variables specifying the limits of integration.

This command uses codes provided by Alan Genz (see the Reference seciton below). In particular, this code supports four different methods:

1. SADMVN - a subregion adaptive integration method developed by Alan Genz.

2. KROMVN - a lattice rule method using randomized Korobov rules.

3. RANMVN - Genz'a Monte-Carlo integration.

4. SPHNRM - Deak's method.

Alan Genz has written several papers comparing the speed and accuracy of these various methods. His basic conclusion is that for moderate accuracy SADMVN and KROMVN are usually much faster (with SADMVN faster for fewer than 10 variables and KROMVN faster for more than 10 variables). By default, Dataplot uses the SADMVN method, but you specify one of the other methods (see the Note section below).

Syntax 1:
LET <par> = MULTIVARIATE NORMAL CDF <sigma> <upplim>
where <sigma> is a matrix containing the desired variance-covariance matrix;
<upplim> is a variable containing the upper levels of integration;
and where <par> is a parameter containing the computed multivariate normal cdf value.

This syntax computes the cdf function.

Syntax 2:
LET <par> = MULTIVARIATE NORMAL CDF <sigma> <lowlim> <upplim>
where <sigma> is a matrix containing the desired variance-covariance matrix;
<lowlim> is a variable containing the lower levels of integration;
<upplim> is a variable containing the upper levels of integration;
and where <par> is a parameter containing the computed multivariate normal cdf value.

This syntax can be used to compute arbitrary integrals of the multivariate normal function.

Examples:
1 0.5 0.5
0.5 1 0.5
0.5 0.5 1
END OF DATA
LET LOWLIM = DATA 1.5 2 0.5
LET A = MULTIVARIATE NORMAL CDF SIGMA LOWLIM
Note:
You can specify which method to use with the following command:

SET MULTIVARIATE NORMAL <method>

where <method> is one of the following:

KROMVN
RANMVN
SPHMVN
Note:
The accuracy of the routine can be specified by entering one of the following command (before entering the MULTIVARIATE NORMAL CDF command):

LET ABSEPS = <value>
LET RELEPS = <value>

These define the desired absolute and relative errors, respectively. The default absolute error is set to 0.00005 and the default relative error is set to 0 (i.e., the absolute error is used). This should be a reasonable choice for most applications.

Note:
The error estimate is returned in the internal parameter NCDFERRS. You can use this parameter like any user created parameter. For example, to see its value, enter PRINT NCDFERRS.
Default:
None
Synonyms:
None
Related Commands:
 NORCDF = Compute the univariate normal cdf function. MULTIVARIATE T CDF = Generate multivariate t cdf function. MULTIVARIATE NORMAL RANDOM NUMBERS = Generate multivariate normal random numbers. MULTIVARIATE T RANDOM NUMBERS = Generate multivariate t random numbers.
Reference:
"Comparison of Methods for the Computation ofMultivariate Normal Probabilities", Alan Genz, Computing Science and Statistics, 25, 1993, pp. 400-405.

"Numerical Computation of Multivariate Normal Probabilities", Alan Genz, Journal of Computational and Graphical Statistics, 1, 1992, pp. 141-149.

Applications:
Bayesian Analysis
Implementation Date:
2003/5
Program:
```read matrix sigma
1.0        -0.707107  0.0  0.0 0.0
-0.707107    1.0       0.5  0.5 0.5
0.0         0.5       1.0  0.5 0.5
0.0         0.5       0.5  1.0 0.5
0.0         0.5       0.5  0.5 1.0
end of data
.
let cpumin = -infinity
let lowl = data 0.0      0.0   1.7817   1.4755   cpumin
let uppl = data infinity 1.5198 infinity infinity 1.5949
.
let a = multivariate normal cdf sigma lowl uppl
set multivariate normal kromvn
let a = multivariate normal cdf sigma lowl uppl
set multivariate normal ranmvn
let a = multivariate normal cdf sigma lowl uppl
set multivariate normal sphmvn
let a = multivariate normal cdf sigma lowl uppl
```
Dataplot generated the following output.
```       *******************************************************
**  let a = multivariate normal cdf sigma lowl uppl  **
*******************************************************

THE COMPUTED VALUE OF THE CONSTANT A             =  0.28695473E-02

**************************************
**  set multivariate normal kromvn  **
**************************************

THE FORTRAN COMMON CHARACTER VARIABLE MULTNORM HAS JUST BEEN SET TO KROM

*******************************************************
**  let a = multivariate normal cdf sigma lowl uppl  **
*******************************************************

THE COMPUTED VALUE OF THE CONSTANT A             =  0.28632688E-02

**************************************
**  set multivariate normal ranmvn  **
**************************************

THE FORTRAN COMMON CHARACTER VARIABLE MULTNORM HAS JUST BEEN SET TO RANM

*******************************************************
**  let a = multivariate normal cdf sigma lowl uppl  **
*******************************************************

THE COMPUTED VALUE OF THE CONSTANT A             =  0.28603778E-02

**************************************
**  set multivariate normal sphmvn  **
**************************************

THE FORTRAN COMMON CHARACTER VARIABLE MULTNORM HAS JUST BEEN SET TO SPHM

*******************************************************
**  let a = multivariate normal cdf sigma lowl uppl  **
*******************************************************

***** WARNING IN MULTIVARIATE NORMAL CDF--
ERROR IS GREATER THAN REQUESTED VALUE OF   0.5000000E-04

THE COMPUTED VALUE OF THE CONSTANT A             =  0.28631196E-02
```

Date created: 5/21/2003
Last updated: 5/21/2003