NAG Library Routine Document
G01LBF
Note: before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.
1 Purpose
G01LBF returns a number of values of the probability density function (PDF), or its logarithm, for the multivariate Normal (Gaussian) distribution.
2 Specification
SUBROUTINE G01LBF (
ILOG,
K,
N,
X,
LDX,
XMU,
IULD,
SIG,
LDSIG,
PDF,
RANK,
IFAIL)
INTEGER
ILOG, K, N, LDX, IULD, LDSIG, RANK, IFAIL
REAL (KIND=nag_wp)
X(LDX,*), XMU(N), SIG(LDSIG,*), PDF(K)
3 Description
The probability density function,
of an
-dimensional multivariate Normal distribution with mean vector
and
by
variance-covariance matrix
, is given by
If the variance-covariance matrix,
, is not of full rank then the probability density function, is calculated as
where
is the pseudo-determinant,
a generalized inverse of
and
its rank.
G01LBF evaluates the PDF at points with a single call.
4 References
None.
5 Parameters
- 1: ILOG – INTEGERInput
On entry: the value of
ILOG determines whether the logarithmic value is returned in PDF.
- , the probability density function is returned.
- , the logarithm of the probability density function is returned.
Constraint:
or .
- 2: K – INTEGERInput
On entry: , the number of points the PDF is to be evaluated at.
Constraint:
.
- 3: N – INTEGERInput
On entry: , the number of dimensions.
Constraint:
.
- 4: X(LDX,) – REAL (KIND=nag_wp) arrayInput
-
Note: the second dimension of the array
X
must be at least
.
On entry: , the matrix of points at which to evaluate the probability density function, with the th dimension for the th point held in .
- 5: LDX – INTEGERInput
On entry: the first dimension of the array
X as declared in the (sub)program from which G01LBF is called.
Constraint:
.
- 6: XMU(N) – REAL (KIND=nag_wp) arrayInput
On entry: , the mean vector of the multivariate Normal distribution.
- 7: IULD – INTEGERInput
On entry: indicates the form of
and how it is stored in
SIG.
- SIG holds the lower triangular portion of .
- SIG holds the upper triangular portion of .
- is a diagonal matrix and SIG only holds the diagonal elements.
- SIG holds the lower Cholesky decomposition, such that .
- SIG holds the upper Cholesky decomposition, such that .
Constraint:
, , , or .
- 8: SIG(LDSIG,) – REAL (KIND=nag_wp) arrayInput
-
Note: the second dimension of the array
SIG
must be at least
.
On entry: information defining the variance-covariance matrix,
.
- or
- SIG must hold the lower or upper portion of , with held in . The supplied variance-covariance matrix must be positive semidefinite.
- is a diagonal matrix and the th diagonal element, , must be held in
- or
- SIG must hold or , the lower or upper Cholesky decomposition of , with or held in , depending on the value of IULD. No check is made that or is a valid variance-covariance matrix. The diagonal elements of the supplied or must be greater than zero
- 9: LDSIG – INTEGERInput
On entry: the first dimension of the array
SIG as declared in the (sub)program from which G01LBF is called.
Constraints:
- if , ;
- otherwise .
- 10: PDF() – REAL (KIND=nag_wp) arrayOutput
On exit:
or
depending on the value of
ILOG.
- 11: RANK – INTEGEROutput
On exit: , rank of .
- 12: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: or .
-
On entry, .
Constraint: .
-
On entry, .
Constraint: .
-
On entry, and .
Constraint: .
-
On entry, .
Constraint: , , , or .
-
On entry, is not positive semidefinite.
-
On entry, at least one diagonal element of is less than or equal to .
-
On entry, is not positive definite and eigenvalue decomposition failed.
-
On entry, .
Constraint: if , .
-
On entry, .
Constraint: if , .
7 Accuracy
Not applicable.
None.
9 Example
This example prints the value of the multivariate Normal PDF at a number of different points.
9.1 Program Text
Program Text (g01lbfe.f90)
9.2 Program Data
Program Data (g01lbfe.d)
9.3 Program Results
Program Results (g01lbfe.r)