g13dsc is a diagnostic checking function suitable for use after fitting a vector ARMA model to a multivariate time series using g13ddc.
The residual cross-correlation matrices are returned along with an estimate of their asymptotic standard errors and correlations. Also, g13dsc calculates the modified Li–McLeod portmanteau statistic and its significance level for testing model adequacy.
The function may be called by the names: g13dsc, nag_tsa_multi_varma_diag or nag_tsa_varma_diagnostic.
3Description
Let , for , denote a vector of time series which is assumed to follow a multivariate ARMA model of the form
(1)
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 g13ddc).
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 Section 9.2.) 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 g13dsc.)
4References
Li W K and McLeod A I (1981) Distribution of the residual autocorrelations in multivariate ARMA time series models J. Roy. Statist. Soc. Ser. B43 231–239
On entry: 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 r, rcm, chi, idf and siglev.
12: – const char *Input
On entry: the name of a file to which diagnostic output will be directed. If outfile is NULL the diagnostic output will be directed to standard output.
13: – doubleOutput
On exit: 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 NE_G13D_RES or NE_G13D_ZERO_VAR on exit then the first k rows and columns of r0 are set to zero.
14: – doubleOutput
Note: the dimension, dim, of the array
r
must be at least
.
where appears in this document, it refers to the array element .
On exit: is an estimate of the th element of the residual cross-correlation matrix at lag , for , and . If NE_G13D_RES or NE_G13D_ZERO_VAR on exit then all elements of r are set to zero.
15: – doubleOutput
Note: the dimension, dim, of the array rcm
must be at least
.
On exit: the estimated standard errors and correlations of the elements in the array r. The correlation between and is returned as where and except that if , then contains the standard error of . If on exit, NE_G13D_DIAG or NE_G13D_FACT, then all off-diagonal elements of RCM are set to zero and all diagonal elements are set to .
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument had an illegal value.
NE_G13D_AR
On entry, the AR parameter matrices are outside the stationarity region. To proceed you must supply different parameter estimates in the arrays par and qq.
NE_G13D_ARMA
On entry, and .
Constraint: must not hold.
NE_G13D_DIAG
The matrix rcm could not be computed because one of its diagonal elements was found to be non-positive. In this case, the off-diagonal elements of rcm are returned as zero and the diagonal elements set to .
NE_G13D_FACT
On entry, the AR operator has a factor in common with the MA operator. To proceed you must either supply different parameter estimates in the array qq or delete this common factor from the model. In this case, the off-diagonal elements of rcm are returned as zero and the diagonal elements set to . All other output quantities will be correct.
NE_G13D_ITER
Excessive iterations needed to find zeros of determinental polynomials.
NE_G13D_MA
On entry, the MA parameter matrices are outside the invertibility region. To proceed you must supply different parameter estimates in the arrays par and qq.
NE_G13D_RES
On entry, at least two of the residual series are identical. In this case chi is set to zero, siglev to one and all the elements of r0 and r are set to zero.
NE_G13D_ZERO_VAR
On entry, at least one of the residual series in the array v has near-zero variance. In this case chi is set to zero, siglev to one and all the elements of r0 and r are set to zero.
NE_INT
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
NE_INT_2
On entry, and .
Constraint: .
On entry, and .
Constraint: .
NE_INT_3
On entry, , and .
Constraint: .
On entry, , and .
Constraint: .
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_NOT_CLOSE_FILE
Cannot close file .
NE_NOT_POS_DEF
On entry, the covariance matrix qq is not positive definite. To proceed you must supply different parameter estimates in the arrays par and qq.
NE_NOT_WRITE_FILE
Cannot open file for writing.
7Accuracy
The computations are believed to be stable.
8Parallelism and Performance
g13dsc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dsc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
9.1Timing
The time taken by g13dsc depends upon the number of residual cross-correlation matrices to be computed, , and the number of time series, .
9.2Choice of
The number of residual cross-correlation matrices to be computed, , should be chosen to ensure that when the ARMA model (1) is written as either an infinite order autoregressive process, i.e.,
or as an infinite order moving average process, i.e.,
then the two sequences of matrices and are such that and are approximately zero for . An overestimate of is, therefore, preferable to an under-estimate of . In many instances the choice will suffice. In practice, to be on the safe side, you should try setting .
9.3Checking a ‘White Noise’ Model
If you have fitted the ‘white noise’ model
then g13dsc should be entered with , , and the first elements of par and parhld set to zero and Nag_TRUE respectively.
9.4Approximate Standard Errors
When NE_G13D_DIAG or NE_G13D_FACT all the standard errors in rcm are set to . This is the asymptotic standard error of when all the autoregressive and moving average parameters are assumed to be known rather than estimated.
9.5Alternative Tests
is useful in testing for instantaneous causality. If you wish to carry out a likelihood ratio test then the covariance matrix at lag zero can be used. It can be recovered from by setting
10Example
This example fits a bivariate AR(1) model to two series each of length . has been estimated but has been constrained to be zero. Ten residual cross-correlation matrices are to be computed.