NAG Library Routine Document
G13DSF
1 Purpose
G13DSF is a diagnostic checking routine suitable for use after fitting a vector ARMA model to a multivariate time series using
G13DDF.
The residual cross-correlation matrices are returned along with an estimate of their asymptotic standard errors and correlations. Also, G13DSF calculates the modified Li–McLeod portmanteau statistic and its significance level for testing model adequacy.
2 Specification
SUBROUTINE G13DSF ( |
K, N, V, KMAX, IP, IQ, M, PAR, PARHLD, QQ, ISHOW, R0, R, RCM, LDRCM, CHI, IDF, SIGLEV, IW, LIW, WORK, LWORK, IFAIL) |
INTEGER |
K, N, KMAX, IP, IQ, M, ISHOW, LDRCM, IDF, IW(LIW), LIW, LWORK, IFAIL |
REAL (KIND=nag_wp) |
V(KMAX,N), PAR((IP+IQ)*K*K), QQ(KMAX,K), R0(KMAX,K), R(KMAX,KMAX,M), RCM(LDRCM,M*K*K), CHI, SIGLEV, WORK(LWORK) |
LOGICAL |
PARHLD((IP+IQ)*K*K) |
|
3 Description
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
by
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
(
by
)
-matrices, the
(
by
)
-matrices, the mean vector
and the residual error covariance matrix
. Let
where denotes the by 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
G13DDF).
The estimated residual cross-correlation matrix at lag
is defined to the
by
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
by
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 8.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
by
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 G13DSF.)
4 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
5 Parameters
The output quantities
K,
N,
V,
KMAX,
IP,
IQ,
PAR,
PARHLD and
QQ from
G13DDF are suitable for input to G13DSF.
- 1: K – INTEGERInput
On entry: , the number of residual time series.
Constraint:
.
- 2: N – INTEGERInput
On entry: , the number of observations in each residual series.
- 3: V(KMAX,N) – REAL (KIND=nag_wp) arrayInput
On entry: must contain an estimate of the th component of , for and .
Constraints:
- no two rows of may be identical;
- in each row there must be at least two distinct elements.
- 4: KMAX – INTEGERInput
On entry: the first dimension of the arrays
V,
QQ and
R0 and
Constraint:
.
- 5: IP – INTEGERInput
On entry: , the number of AR parameter matrices.
Constraint:
.
- 6: IQ – INTEGERInput
On entry: , the number of MA parameter matrices.
Constraint:
.
Note: is not permitted.
- 7: M – INTEGERInput
On entry: the value of
, the number of residual cross-correlation matrices to be computed. See
Section 8.2 for advice on the choice of
M.
Constraint:
.
- 8: PAR() – REAL (KIND=nag_wp) arrayInput
On entry: 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 and ;
- if ,
must be set equal to an estimate of the th element of , for and .
The first
elements of
PAR must satisfy the stationarity condition and the next
elements of
PAR must satisfy the invertibility condition.
- 9: PARHLD() – LOGICAL arrayInput
On entry: must be set to .TRUE. if has been held constant at a pre-specified value and .FALSE. if is a free parameter, for .
- 10: QQ(KMAX,K) – REAL (KIND=nag_wp) arrayInput/Output
On entry: is an efficient estimate of the th element of . The lower triangle only is needed.
Constraint:
must be positive definite.
On exit: if , then the upper triangle is set equal to the lower triangle.
- 11: ISHOW – INTEGERInput
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: R0(KMAX,K) – REAL (KIND=nag_wp) arrayOutput
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
on exit then the first
K rows and columns of
R0 are set to zero.
- 13: R(KMAX,KMAX,M) – REAL (KIND=nag_wp) arrayOutput
On exit:
is an estimate of the
th element of the residual cross-correlation matrix at lag
, for
,
and
. If
on exit then all elements of
R are set to zero.
- 14: RCM(LDRCM,) – REAL (KIND=nag_wp) arrayOutput
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,
, then all off-diagonal elements of
RCM are set to zero and all diagonal elements are set to
.
- 15: LDRCM – INTEGERInput
On entry: the first dimension of the array
RCM as declared in the (sub)program from which G13DSF is called.
Constraint:
.
- 16: CHI – REAL (KIND=nag_wp)Output
On exit: the value of the modified portmanteau statistic,
. If
on exit then
CHI is returned as zero.
- 17: IDF – INTEGEROutput
On exit: the number of degrees of freedom of
CHI.
- 18: SIGLEV – REAL (KIND=nag_wp)Output
On exit: the significance level of
CHI based on
IDF degrees of freedom. If
on exit,
SIGLEV is returned as one.
- 19: IW(LIW) – INTEGER arrayWorkspace
- 20: LIW – INTEGERInput
On entry: the dimension of the array
IW as declared in the (sub)program from which G13DSF is called.
Constraint:
.
- 21: WORK(LWORK) – REAL (KIND=nag_wp) arrayWorkspace
- 22: LWORK – INTEGERInput
On entry: the dimension of the array
WORK as declared in the (sub)program from which G13DSF is called.
Constraint:
if , .
- 23: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
on exit, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: G13DSF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | LIW is too small, |
or | LWORK is too small. |
-
On entry, either
QQ is not positive definite or the autoregressive parameter matrices are extremely close to or outside the stationarity region, or the moving average parameter matrices are extremely close to or outside the invertibility region. To proceed, you must supply different parameter estimates in the arrays
PAR and
QQ.
On entry, at least one of the
residual series is such that all its elements are practically identical giving zero (or near zero) variance or 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 set to zero.
This is an unlikely exit brought about by an excessive number of iterations being needed to evaluate the zeros of the determinantal polynomials and . All output parameters are undefined.
On entry, either the eigenvalues and eigenvectors of
(the matrix
QQ in correlation form) could not be computed or the determinantal polynomials
and
have a factor in common. 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.
This is an unlikely exit. At least one of the diagonal elements of
RCM was found to be either negative or zero. In this case all off-diagonal elements of
RCM are returned as zero and all diagonal elements of
RCM set to
.
7 Accuracy
The computations are believed to be stable.
The time taken by G13DSF depends upon the number of residual cross-correlation matrices to be computed, , and the number of time series, .
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
by
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
.
If you have fitted the ‘white noise’ model
then G13DSF should be entered with
,
, and the first
elements of
PAR and
PARHLD set to zero and .TRUE. respectively.
When
or
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.
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
9 Example
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.
9.1 Program Text
Program Text (g13dsfe.f90)
9.2 Program Data
Program Data (g13dsfe.d)
9.3 Program Results
Program Results (g13dsfe.r)