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..::..StringOn entry: indicates which probability is to be returned.
- The lower tail probability is returned.
- The upper tail probability is returned.
- The central probability is returned.
Constraint: , or .
- n
- Type: System..::..Int32On entry: , the number of dimensions.Constraint: .
- a
- Type: array<System..::..Double>[]()[][]An array of size [n]On entry: if or , the lower bounds, , for .If , a is not referenced.
- b
- Type: array<System..::..Double>[]()[][]An array of size [n]On entry: if or , the upper bounds, , for .If b, is not referenced.Constraint: if , , for .
- 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: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..::..DoubleOn entry: 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.Suggested value: .Constraint: if , .
- ifail
- Type: System..::..Int32%On exit: 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 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 g01ha and numerical integration is then used over the remaining dimensions. In the case of ,
d01aj
is used and for d01fc
is used.
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 , or , 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.
On entry, , or , or , or , or and , or lwk is too small.
On entry, and , for some .
On entry, is not positive definite, i.e., is not a correct variance-covariance matrix.
- 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.
- 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 .
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.
Parallelism and Performance
None.
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.
Example program (C#): g01hbe.cs