g01hb returns the upper tail, lower tail or central probability associated with a multivariate Normal distribution of up to ten dimensions.

Syntax

C#
public static double g01hb(
	string tail,
	int n,
	double[] a,
	double[] b,
	double[] xmu,
	double[,] sig,
	double tol,
	out int ifail
)
Visual Basic
Public Shared Function g01hb ( _
	tail As String, _
	n As Integer, _
	a As Double(), _
	b As Double(), _
	xmu As Double(), _
	sig As Double(,), _
	tol As Double, _
	<OutAttribute> ByRef ifail As Integer _
) As Double
Visual C++
public:
static double g01hb(
	String^ tail, 
	int n, 
	array<double>^ a, 
	array<double>^ b, 
	array<double>^ xmu, 
	array<double,2>^ sig, 
	double tol, 
	[OutAttribute] int% ifail
)
F#
static member g01hb : 
        tail : string * 
        n : int * 
        a : float[] * 
        b : float[] * 
        xmu : float[] * 
        sig : float[,] * 
        tol : float * 
        ifail : int byref -> float 

Parameters

tail
Type: System..::..String
On entry: indicates which probability is to be returned.
tail="L"
The lower tail probability is returned.
tail="U"
The upper tail probability is returned.
tail="C"
The central probability is returned.
Constraint: tail="L", "U" or "C".
n
Type: System..::..Int32
On entry: n, the number of dimensions.
Constraint: 1n10.
a
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: if tail="C" or "U", the lower bounds, ai, for i=1,2,,n.
If tail="L", a is not referenced.
b
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: if tail="C" or "L", the upper bounds, bi, for i=1,2,,n.
If tail="U" b, is not referenced.
Constraint: if tail="C", a[i-1]<b[i-1], for i=1,2,,n.
xmu
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: μ, the mean vector of the multivariate Normal distribution.
sig
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, n]
Note: dim1 must satisfy the constraint: dim1n
On entry: Σ, the variance-covariance matrix of the multivariate Normal distribution. Only the lower triangle is referenced.
Constraint: Σ must be positive definite.
tol
Type: System..::..Double
On entry: if n>2 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 n=1, tol is not referenced.
Suggested value: tol=0.0001.
Constraint: if n>1, tol>0.0.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Return Value

g01hb returns the upper tail, lower tail or central probability associated with a multivariate Normal distribution of up to ten dimensions.

Description

Let the vector random variable X=X1,X2,,XnT follow an n-dimensional multivariate Normal distribution with mean vector μ and n by n variance-covariance matrix Σ, then the probability density function, fX:μ,Σ, is given by
fX:μ,Σ=2π-1/2nΣ-1/2exp-12X-μTΣ-1X-μ.
The lower tail probability is defined by:
PX1b1,,Xnbn:μ,Σ=-b1-bnfX:μ,ΣdXndX1.
The upper tail probability is defined by:
PX1a1,,Xnan:μ,Σ=a1anfX:μ,ΣdXndX1.
The central probability is defined by:
Pa1X1b1,,anXnbn:μ,Σ=a1b1anbnfX:μ,ΣdXndX1.
To evaluate the probability for n3, the probability density function of X1,X2,,Xn is considered as the product of the conditional probability of X1,X2,,Xn-2 given Xn-1 and Xn and the marginal bivariate Normal distribution of Xn-1 and Xn. The bivariate Normal probability can be evaluated as described in g01ha and numerical integration is then used over the remaining n-2 dimensions. In the case of n=3, d01aj is used and for n>3 d01fc is used.
To evaluate the probability for n=1 a direct call to g01ea is made and for n=2 calls to g01ha are made.

References

Kendall M G and Stuart A (1969) The Advanced Theory of Statistics (Volume 1) (3rd Edition) Griffin

Error Indicators and Warnings

Note: g01hb may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
If on exit ifail=12 or 3, then g01hb returns zero.
Some error messages may refer to parameters that are dropped from this interface (LDSIG) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,n<1,
orn>10,
ortail"L", "U" or "C",
orn>1 and tol0.0,
orlwk is too small.
ifail=2
On entry,tail="C" and a[i-1]b[i-1], for some i=0,1,,n-1.
ifail=3
On entry,Σ is not positive definite, i.e., is not a correct variance-covariance matrix.
ifail=4
The requested accuracy has not been achieved, a larger value of tol should be tried or the length of the workspace should be increased. The returned value will be an approximation to the required result.
ifail=5
Round-off error prevents the requested accuracy from being achieved; a larger value of tol should be tried. The returned value will be an approximation to the required result. This error will only occur if n=3.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The accuracy should be as specified by tol. When on exit ifail=4 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 n-2 dimensions over which the numerical integration takes place; these cut-off points are given by Φ-1tol/10×n, where Φ-1 is the inverse univariate Normal distribution function.

Parallelism and Performance

None.

Further Comments

The time taken is related to the number of dimensions, the range over which the integration takes place (bi-ai, for i=1,2,,n) 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 X so that the largest ranges of integration are for Xn-1 and Xn.

Example

This example reads in the mean and covariance matrix for a multivariate Normal distribution and computes and prints the associated central probability.

Example program (C#): g01hbe.cs

Example program data: g01hbe.d

Example program results: g01hbe.r

See Also