naginterfaces.library.tsa.multi_​corrmat_​cross

naginterfaces.library.tsa.multi_corrmat_cross(matrix, m, w)[source]

multi_corrmat_cross calculates the sample cross-correlation (or cross-covariance) matrices of a multivariate time series.

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

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g13/g13dmf.html

Parameters
matrixstr, length 1

Indicates whether the cross-covariance or cross-correlation matrices are to be computed.

The cross-covariance matrices are computed.

The cross-correlation matrices are computed.

mint

, the number of cross-correlation (or cross-covariance) matrices to be computed. If in doubt set . However it should be noted that is usually taken to be at most .

wfloat, array-like, shape

must contain the observation , for , for .

Returns
wmeanfloat, ndarray, shape

The means, , for .

r0float, ndarray, shape

If , then contains an estimate of the th element of the cross-correlation (or cross-covariance) matrix at lag zero, ; if , then if , contains the variance of the th series, , and if , contains the standard deviation of the th series, .

If = 2 and , then on exit all the elements in whose computation involves the zero variance are set to zero.

rfloat, ndarray, shape

contains an estimate of the ()th element of the cross-correlation (or cross-covariance) at lag , , for , for , for .

If = 2 and , then on exit all the elements in whose computation involves the zero variance are set to zero.

Raises
NagValueError
(errno )

On entry, and .

Constraint: and .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: or .

Warns
NagAlgorithmicWarning
(errno )

On entry, at least one of the series is such that all its elements are practically identical giving zero (or near zero) variance.

Notes

Let , for , denote observations of a vector of time series. The sample cross-covariance matrix at lag is defined to be the matrix , whose ()th element is given by

where and denote the sample means for the th and th series respectively. The sample cross-correlation matrix at lag is defined to be the matrix , whose th element is given by

The number of lags, , is usually taken to be at most .

If follows a vector moving average model of order , then it can be shown that the theoretical cross-correlation matrices are zero beyond lag . In order to help spot a possible cut-off point, the elements of are usually compared to their approximate standard error of 1/. For further details see, for example, Wei (1990).

The function uses a single pass through the data to compute the means and the cross-covariance matrix at lag zero. The cross-covariance matrices at further lags are then computed on a second pass through the data.

References

Wei, W W S, 1990, Time Series Analysis: Univariate and Multivariate Methods, Addison–Wesley

West, D H D, 1979, Updating mean and variance estimates: An improved method, Comm. ACM (22), 532–555