The routine may be called by the names g01naf or nagf_stat_moments_quad_form.
3Description
Let have an -dimensional multivariate Normal distribution with mean and variance-covariance matrix . Then for a symmetric matrix , g01naf computes up to the first moments and cumulants of the quadratic form . The th moment (about the origin) is defined as
where denotes expectation. The th moment of can also be found as the coefficient of in the expansion of . The th cumulant is defined as the coefficient of in the expansion of .
Magnus J R (1978) The moments of products of quadratic forms in Normal variables Statist. Neerlandica32 201–210
Magnus J R (1979) The expectation of products of quadratic forms in Normal variables: the practice Statist. Neerlandica33 131–136
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 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 if moments are computed in addition to cumulants.
Note: the dimension of the array rmom
must be at least
if , and at least otherwise.
On exit: if , the l moments of the quadratic form.
12: – Real (Kind=nag_wp) arrayWorkspace
13: – 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. 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).
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
In a range of tests the accuracy was found to be a modest multiple of machine precision. See Magnus and Pesaran (1993b).
8Parallelism and Performance
g01naf 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.