The routine may be called by the names g01nbf or nagf_stat_moments_ratio_quad_forms.
3Description
Let have an -dimensional multivariate Normal distribution with mean and variance-covariance matrix . Then for a symmetric matrix and symmetric positive semidefinite matrix , g01nbf computes a subset, to , of the first moments of the ratio of quadratic forms
The th moment (about the origin) is defined as
(1)
where denotes the expectation. Alternatively, this routine will compute the following expectations:
(2)
and
(3)
where is a vector of length and is an symmetric matrix, if they exist. In the case of (2) the moments are zero if .
The conditions of theorems 1, 2 and 3 of Magnus (1986) and Magnus (1990) are used to check for the existence of the moments. If all the requested moments do not exist, the computations are carried out for those moments that are requested up to the maximum that exist, .
This routine is based on the routine QRMOM written by Magnus and Pesaran (1993a) and based on the theory given by Magnus (1986) and Magnus (1990). The computation of the moments requires first the computation of the eigenvectors of the matrix , where . The matrix must be positive semidefinite and not null. Given the eigenvectors of this matrix, a function which has to be integrated over the range zero to infinity can be computed. This integration is performed using
d01amf.
4References
Magnus J R (1986) The exact moments of a ratio of quadratic forms in Normal variables Ann. Économ. Statist.4 95–109
Magnus J R (1990) On certain moments relating to quadratic forms in Normal variables: Further results Sankhyā, Ser. B52 1–13
Magnus J R and Pesaran B (1993a) The evaluation of cumulants and moments of quadratic forms in Normal variables (CUM): Technical description Comput. Statist.8 39–45
Magnus J R and Pesaran B (1993b) The evaluation of moments of quadratic forms and ratios of quadratic forms in Normal variables: Background, motivation and examples Comput. Statist.8 47–55
5Arguments
1: – Character(1)Input
On entry: indicates the moments of which function are to be computed.
On entry: the variance-covariance matrix . Only the lower triangle is referenced.
Constraint:
the matrix must be positive definite.
13: – IntegerInput
On entry: the first dimension of the array sigma as declared in the (sub)program from which g01nbf is called.
Constraint:
.
14: – IntegerInput
On entry: the first moment to be computed, .
Constraint:
.
15: – IntegerInput
On entry: the last moment to be computed, .
Constraint:
.
16: – IntegerOutput
On exit: the highest moment computed, . This will be if on exit.
17: – Real (Kind=nag_wp) arrayOutput
On exit: the to moments.
18: – Real (Kind=nag_wp)Output
On exit: the estimated maximum absolute error in any computed moment.
19: – Real (Kind=nag_wp)Input
On entry: the relative accuracy required for the moments, this value is also used in the checks for the existence of the moments.
If , a value of where is the machine precision used.
Constraint:
or .
20: – Real (Kind=nag_wp) arrayWorkspace
21: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended since useful values can be provided in some output arguments even when on exit. When the value or 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).
6Error 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:
Note: in some cases g01nbf may return useful information.
On entry, .
Constraint: , or .
On entry, .
Constraint: if , .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: or .
On entry, .
Constraint: .
On entry, b is not positive semidefinite or is null.
Only moments exist, less than , therefore, none of the required moments can be computed.
The matrix is not positive semidefinite or is null.
The computation to compute the eigenvalues required in the calculation of moments has failed to converge: this is an unlikely error exit.
Only some of the required moments have been computed, the highest is given by lmax.
The required accuracy has not been achieved in the integration. An estimate of the accuracy is returned in abserr.
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The relative accuracy is specified by eps and an estimate of the maximum absolute error for all computed moments is returned in abserr.
8Parallelism and Performance
g01nbf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.