naginterfaces.library.tsa.multi_varma_diag¶
- naginterfaces.library.tsa.multi_varma_diag(v, ip, iq, m, par, parhld, qq, ishow, io_manager=None)[source]¶
multi_varma_diag
is a diagnostic checking function suitable for use after fitting a vector ARMA model to a multivariate time series usingmulti_varma_estimate()
. The residual cross-correlation matrices are returned along with an estimate of their asymptotic standard errors and correlations. Also,multi_varma_diag
calculates the modified Li–McLeod portmanteau statistic and its significance level for testing model adequacy.For full information please refer to the NAG Library document for g13ds
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g13/g13dsf.html
- Parameters
- vfloat, array-like, shape
must contain an estimate of the th component of , for , for .
- ipint
, the number of AR parameter matrices.
- iqint
, the number of MA parameter matrices.
- mint
The value of , the number of residual cross-correlation matrices to be computed. See Further Comments for advice on the choice of .
- parfloat, array-like, shape
The parameter estimates read in row by row in the order , .
Thus,
if , must be set equal to an estimate of the th element of , for , for ;
if , must be set equal to an estimate of the th element of , for , for .
The first elements of must satisfy the stationarity condition and the next elements of must satisfy the invertibility condition.
- parhldbool, array-like, shape
must be set to if has been held constant at a pre-specified value and if is a free parameter, for .
- qqfloat, array-like, shape
is an efficient estimate of the th element of . The lower triangle only is needed.
- ishowint
Must be nonzero if the residual cross-correlation matrices and their standard errors , the modified portmanteau statistic with its significance and a summary table are to be printed. The summary table indicates which elements of the residual correlation matrices are significant at the level in either a positive or negative direction; i.e., if then a ‘’ is printed, if then a ‘’ is printed, otherwise a fullstop (.) is printed. The summary table is only printed if on entry.
The residual cross-correlation matrices, their standard errors and the modified portmanteau statistic with its significance are available also as output variables in , , , and .
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- Returns
- qqfloat, ndarray, shape
If != 1, then the upper triangle is set equal to the lower triangle.
- r0float, ndarray, shape
If , then contains an estimate of the th element of the residual cross-correlation matrix at lag zero, . When , contains the standard deviation of the th residual series. If = 3 on exit then the first rows and columns of are set to zero.
- rfloat, ndarray, shape
is an estimate of the th element of the residual cross-correlation matrix at lag , for , for , for . If = 3 on exit then all elements of are set to zero.
- rcmfloat, ndarray, shape
The estimated standard errors and correlations of the elements in the array . The correlation between and is returned as where and except that if , then contains the standard error of . If on exit, >= 5, then all off-diagonal elements of are set to zero and all diagonal elements are set to .
- chifloat
The value of the modified portmanteau statistic, . If = 3 on exit then is returned as zero.
- idfint
The number of degrees of freedom of .
- siglevfloat
The significance level of based on degrees of freedom. If = 3 on exit, is returned as one.
- Raises
- NagValueError
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, and .
Constraint: must not hold.
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, the MA parameter matrices are outside the invertibility region.
- (errno )
On entry, the AR parameter matrices are outside the stationarity region.
- (errno )
On entry, the covariance matrix is not positive definite.
- (errno )
Excessive iterations needed to find zeros of determinental polynomials.
- (errno )
On entry, the AR operator has a factor in common with the MA operator.
- (errno )
The matrix could not be computed because one of its diagonal elements was found to be non-positive.
- Warns
- NagAlgorithmicWarning
- (errno )
On entry, at least one of the residual series in the array has near-zero variance.
- (errno )
On entry, at least two of the residual series are identical.
- Notes
Let , for , denote a vector of time series which is assumed to follow a multivariate ARMA model of the form
where , for , is a vector of residual series assumed to be Normally distributed with zero mean and positive definite covariance matrix . The components of are assumed to be uncorrelated at non-simultaneous lags. The and are matrices of parameters. , for , are called the autoregressive (AR) parameter matrices, and , for , the moving average (MA) parameter matrices. The parameters in the model are thus the () -matrices, the () -matrices, the mean vector and the residual error covariance matrix . Let
where denotes the identity matrix.
The ARMA model (1) is said to be stationary if the eigenvalues of lie inside the unit circle, and invertible if the eigenvalues of lie inside the unit circle. The ARMA model is assumed to be both stationary and invertible. Note that some of the elements of the - and/or -matrices may have been fixed at pre-specified values (for example by calling
multi_varma_estimate()
).The estimated residual cross-correlation matrix at lag is defined to the matrix whose th element is computed as
where denotes an estimate of the th residual for the th series and . (Note that is an estimate of , where is the expected value.)
A modified portmanteau statistic, , is calculated from the formula (see Li and McLeod (1981))
where denotes Kronecker product, is the estimated residual cross-correlation matrix at lag zero and , where of a matrix is a vector with the th element in position . denotes the number of residual cross-correlation matrices computed. (Advice on the choice of is given in Further Comments.) Let denote the total number of ‘free’ parameters in the ARMA model excluding the mean, , and the residual error covariance matrix . Then, under the hypothesis of model adequacy, , has an asymptotic -distribution on degrees of freedom.
Let then the covariance matrix of is given by
where and . is the dispersion matrix in correlation form and a nonsingular matrix such that and . The construction of the matrix is discussed in Li and McLeod (1981). (Note that the mean, , plays no part in calculating and, therefore, is not required as input to
multi_varma_diag
.)
- References
Li, W K and McLeod, A I, 1981, Distribution of the residual autocorrelations in multivariate ARMA time series models, J. Roy. Statist. Soc. Ser. B (43), 231–239