naginterfaces.library.stat.moments_​quad_​form

naginterfaces.library.stat.moments_quad_form(a, sigma, l, emu=None)[source]

moments_quad_form computes the cumulants and moments of quadratic forms in Normal variates.

For full information please refer to the NAG Library document for g01na

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g01/g01naf.html

Parameters
afloat, array-like, shape

The symmetric matrix . Only the lower triangle is referenced.

sigmafloat, array-like, shape

The variance-covariance matrix . Only the lower triangle is referenced.

lint

The required number of cumulants, and moments if specified.

emuNone or float, array-like, shape , optional

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If , must contain the elements of the vector .

If , is not referenced.

Returns
rkumfloat, ndarray, shape

The cumulants of the quadratic form.

rmomfloat, ndarray, shape

If , the moments of the quadratic form.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, is not positive definite.

Notes

Let have an -dimensional multivariate Normal distribution with mean and variance-covariance matrix . Then for a symmetric matrix , moments_quad_form 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 function is based on the function 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, 1993, 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, 1993, The evaluation of moments of quadratic forms and ratios of quadratic forms in Normal variables: Background, motivation and examples, Comput. Statist. (8), 47–55