PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_pdf_multi_normal_vector (g01lb)
Purpose
nag_stat_pdf_multi_normal_vector (g01lb) returns a number of values of the probability density function (PDF), or its logarithm, for the multivariate Normal (Gaussian) distribution.
Syntax
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 25: |
k was made optional |
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.
nag_stat_pdf_multi_normal_vector (g01lb) evaluates the PDF at points with a single call.
References
None.
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
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:
– int64int32nag_int scalar
-
, the number of points the PDF is to be evaluated at.
Constraint:
.
- 3:
– double array
-
The first dimension of the array
x must be at least
.
The second dimension of the array
x must be at least
.
, the matrix of points at which to evaluate the probability density function, with the th dimension for the th point held in .
- 4:
– double array
-
, the mean vector of the multivariate Normal distribution.
- 5:
– int64int32nag_int scalar
-
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 .
- 6:
– double array
-
The first dimension,
, of the array
sig must satisfy
- if , ;
- otherwise .
The second dimension of the array
sig must be at least
.
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
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
x and the dimension of the array
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:
.
Output Parameters
- 1:
– double array
-
or
depending on the value of
ilog.
- 2:
– int64int32nag_int scalar
-
, rank of .
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
Constraint: or .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
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.
-
-
Constraint: if , .
-
-
Constraint: if , .
-
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
Not applicable.
Further Comments
None.
Example
This example prints the value of the multivariate Normal PDF at a number of different points.
Open in the MATLAB editor:
g01lb_example
function g01lb_example
fprintf('g01lb example results\n\n');
ilog = int64(0);
k = int64(2);
iuld = int64(1);
xmu = [0.1; 0.2; 0.3; 0.4];
sig = [4.16, 0, 0, 0;
-3.12, 5.03, 0, 0;
0.56, -0.83, 0.76, 0;
-0.10, 1.18, 0.34, 1.18];
x = [1, 1;
1, 2;
1, 3;
1, 4];
[pdf, rnk, ifail] = g01lb(ilog, x, xmu, iuld, sig);
fprintf('\nRank of the covariance matrix: %d\n', rnk);
if ilog == 1
fprintf(' log(PDF) X\n');
else
fprintf(' PDF X\n');
end
for i=1:k
fprintf('%13.4e %8.4f %8.4f %8.4f %8.4f\n', pdf(i), x(:, i));
end
g01lb example results
Rank of the covariance matrix: 4
PDF X
3.0307e-03 1.0000 1.0000 1.0000 1.0000
4.5232e-06 1.0000 2.0000 3.0000 4.0000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015