g01na computes the cumulants and moments of quadratic forms in Normal variates.
Syntax
C# |
---|
public static void g01na( string mom, string mean, int n, double[,] a, double[] emu, double[,] sigma, int l, double[] rkum, double[] rmom, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g01na ( _ mom As String, _ mean As String, _ n As Integer, _ a As Double(,), _ emu As Double(), _ sigma As Double(,), _ l As Integer, _ rkum As Double(), _ rmom As Double(), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g01na( String^ mom, String^ mean, int n, array<double,2>^ a, array<double>^ emu, array<double,2>^ sigma, int l, array<double>^ rkum, array<double>^ rmom, [OutAttribute] int% ifail ) |
F# |
---|
static member g01na : mom : string * mean : string * n : int * a : float[,] * emu : float[] * sigma : float[,] * l : int * rkum : float[] * rmom : float[] * ifail : int byref -> unit |
Parameters
- mom
- Type: System..::..StringOn entry: indicates if moments are computed in addition to cumulants.
- Only cumulants are computed.
- Moments are computed in addition to cumulants.
Constraint: or .
- mean
- Type: System..::..StringOn entry: indicates if the mean, , is zero.
- is zero.
- The value of is supplied in emu.
Constraint: or .
- n
- Type: System..::..Int32On entry: , the dimension of the quadratic form.Constraint: .
- a
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, n]Note: dim1 must satisfy the constraint:On entry: the by symmetric matrix . Only the lower triangle is referenced.
- emu
- Type: array<System..::..Double>[]()[][]An array of size [dim1]Note: the dimension of the array emu must be at least if , and at least otherwise.
- sigma
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, n]Note: dim1 must satisfy the constraint:On entry: the by variance-covariance matrix . Only the lower triangle is referenced.Constraint: the matrix must be positive definite.
- l
- Type: System..::..Int32On entry: the required number of cumulants, and moments if specified.Constraint: .
- rkum
- Type: array<System..::..Double>[]()[][]An array of size [l]On exit: the l cumulants of the quadratic form.
- rmom
- Type: array<System..::..Double>[]()[][]An array of size [dim1]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.
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Let have an -dimensional multivariate Normal distribution with mean and variance-covariance matrix . Then for a symmetric matrix , g01na 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 .
The method is based on the method CUM written by Magnus and Pesaran (1993a) and based on the theory given by Magnus (1978), Magnus (1979) and Magnus (1986).
References
Magnus J R (1978) The moments of products of quadratic forms in Normal variables Statist. Neerlandica 32 201–210
Magnus J R (1979) The expectation of products of quadratic forms in Normal variables: the practice Statist. Neerlandica 33 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
Error Indicators and Warnings
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface
(LDA, LDSIG) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, , or , or , or or , or or .
On entry, the matrix is not positive definite.
Accuracy
In a range of tests the accuracy was found to be a modest multiple of machine precision. See Magnus and Pesaran (1993b).
Parallelism and Performance
None.
Further Comments
None.
Example
This example is given by Magnus and Pesaran (1993b) and considers the simple autoregression
where is a sequence of independent Normal variables with mean zero and variance one, and is known. The moments of the quadratic form
are computed using g01na. The matrix is given by:
The value of can be computed using the relationships
and
for and .
The values of , , , and the number of moments required are read in and the moments and cumulants printed.
Example program (C#): g01nae.cs