PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_prob_multi_normal (g01hb)
Purpose
nag_stat_prob_multi_normal (g01hb) returns the upper tail, lower tail or central probability associated with a multivariate Normal distribution of up to ten dimensions.
Syntax
[
result,
ifail] = g01hb(
xmu,
sig, 'n',
n, 'a',
a, 'b',
b, 'tol',
tol)
[
result,
ifail] = nag_stat_prob_multi_normal(
xmu,
sig, 'n',
n, 'a',
a, 'b',
b, 'tol',
tol)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
a and b were made optional; tail was removed from the interface |
Description
Let the vector random variable
follow an
-dimensional multivariate Normal distribution with mean vector
and
by
variance-covariance matrix
, then the probability density function,
, is given by
The lower tail probability is defined by:
The upper tail probability is defined by:
The central probability is defined by:
To evaluate the probability for
, the probability density function of
is considered as the product of the conditional probability of
given
and
and the marginal bivariate Normal distribution of
and
. The bivariate Normal probability can be evaluated as described in
nag_stat_prob_bivariate_normal (g01ha) and numerical integration is then used over the remaining
dimensions. In the case of
,
nag_quad_1d_fin_bad (d01aj)
is used and for
nag_quad_md_adapt (d01fc)
is used.
To evaluate the probability for
a direct call to
nag_stat_prob_normal (g01ea) is made and for
calls to
nag_stat_prob_bivariate_normal (g01ha) are made.
References
Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin
Parameters
Compulsory Input Parameters
- 1:
– double array
-
, the mean vector of the multivariate Normal distribution.
- 2:
– double array
-
ldsig, the first dimension of the array, must satisfy the constraint
.
, the variance-covariance matrix of the multivariate Normal distribution. Only the lower triangle is referenced.
Constraint:
must be positive definite.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
a,
b,
xmu and the first dimension of the array
sig and the second dimension of the array
sig. (An error is raised if these dimensions are not equal.)
, the number of dimensions.
Constraint:
.
- 2:
– double array
-
If upper tail or central probablilities are to be returned,
a should supply the lower bounds,
, for
.
- 3:
– double array
-
If lower tail or central probablilities are to be returned,
b should supply the upper bounds,
, for
.
- 4:
– double scalar
Default:
If
the relative accuracy required for the probability, and if the upper or the lower tail probability is requested then
tol is also used to determine the cut-off points, see
Accuracy.
If
,
tol is not referenced.
Constraint:
if , .
Output Parameters
- 1:
– double scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_stat_prob_multi_normal (g01hb) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
If on exit , or , then nag_stat_prob_multi_normal (g01hb) returns zero.
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
Constraint: .
Constraint: .
Constraint: .
-
-
On entry, the
value in
b is less than or equal to the corresponding value in
a.
-
-
On entry,
sig is not positive definite.
- W
-
Full accuracy not achieved, relative accuracy
.
A larger value of
tol can be tried or the length of the workspace increased. The returned value is an approximation to the required result.
- W
-
Accuracy requested by
tol is too strict:
.
Round-off error has prevented the requested accuracy from being achieved; a larger value of
tol can be tried. The returned value will be an approximation to the required result.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The accuracy should be as specified by
tol. When on exit
the approximate accuracy achieved is given in the error message. For the upper and lower tail probabilities the infinite limits are approximated by cut-off points for the
dimensions over which the numerical integration takes place; these cut-off points are given by
, where
is the inverse univariate Normal distribution function.
Further Comments
The time taken is related to the number of dimensions, the range over which the integration takes place (, for ) and the value of as well as the accuracy required. As the numerical integration does not take place over the last two dimensions speed may be improved by arranging so that the largest ranges of integration are for and .
Example
This example reads in the mean and covariance matrix for a multivariate Normal distribution and computes and prints the associated central probability.
Open in the MATLAB editor:
g01hb_example
function g01hb_example
fprintf('g01hb example results\n\n');
a = [-2; -2; -2; -2 ];
b = [ 2; 2; 2; 2 ];
xmu = [ 0; 0; 0; 0 ];
sig = [ 1.0, 0.9, 0.9, 0.9;
0.9, 1.0, 0.9, 0.9;
0.9, 0.9, 1.0, 0.9;
0.9, 0.9, 0.9, 1.0];
[p, ifail] = g01hb(xmu, sig, 'a', a, 'b', b);
fprintf('Multivariate Normal probability = %7.4f\n', p);
g01hb example results
Multivariate Normal probability = 0.9142
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015