NAG FL Interface
g13dsf (multi_varma_diag)
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
Fortran Interface
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, Intent (In) |
:: |
k, n, kmax, ip, iq, m, ishow, ldrcm, liw, lwork |
Integer, Intent (Inout) |
:: |
ifail |
Integer, Intent (Out) |
:: |
idf, iw(liw) |
Real (Kind=nag_wp), Intent (In) |
:: |
v(kmax,n), par((ip+iq)*k*k) |
Real (Kind=nag_wp), Intent (Inout) |
:: |
qq(kmax,k), r0(kmax,k), r(kmax,kmax,m), rcm(ldrcm,m*k*k) |
Real (Kind=nag_wp), Intent (Out) |
:: |
chi, siglev, work(lwork) |
Logical, Intent (In) |
:: |
parhld((ip+iq)*k*k) |
|
C Header Interface
#include <nag.h>
void |
g13dsf_ (const Integer *k, const Integer *n, const double v[], const Integer *kmax, const Integer *ip, const Integer *iq, const Integer *m, const double par[], const logical parhld[], double qq[], const Integer *ishow, double r0[], double r[], double rcm[], const Integer *ldrcm, double *chi, Integer *idf, double *siglev, Integer iw[], const Integer *liw, double work[], const Integer *lwork, Integer *ifail) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
g13dsf_ (const Integer &k, const Integer &n, const double v[], const Integer &kmax, const Integer &ip, const Integer &iq, const Integer &m, const double par[], const logical parhld[], double qq[], const Integer &ishow, double r0[], double r[], double rcm[], const Integer &ldrcm, double &chi, Integer &idf, double &siglev, Integer iw[], const Integer &liw, double work[], const Integer &lwork, Integer &ifail) |
}
|
The routine may be called by the names g13dsf or nagf_tsa_multi_varma_diag.
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 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
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
Arguments
The output quantities
k,
n,
v,
kmax,
ip,
iq,
par,
parhld and
qq from
g13ddf are suitable for input to
g13dsf.
-
1:
– Integer
Input
-
On entry: , the number of residual time series.
Constraint:
.
-
2:
– Integer
Input
-
On entry: , the number of observations in each residual series.
-
3:
– Real (Kind=nag_wp) array
Input
-
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:
– Integer
Input
-
On entry: the first dimension of the arrays
v,
qq,
r and
r0 and the second dimension of the array
r as declared in the (sub)program from which
g13dsf is called.
Constraint:
.
-
5:
– Integer
Input
-
On entry: , the number of AR parameter matrices.
Constraint:
.
-
6:
– Integer
Input
-
On entry: , the number of MA parameter matrices.
Constraint:
.
Note: is not permitted.
-
7:
– Integer
Input
-
On entry: the value of
, the number of residual cross-correlation matrices to be computed. See
Section 9.2 for advice on the choice of
m.
Constraint:
.
-
8:
– Real (Kind=nag_wp) array
Input
-
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:
– Logical array
Input
-
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:
– Real (Kind=nag_wp) array
Input/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:
– Integer
Input
-
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:
– Real (Kind=nag_wp) array
Output
-
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:
– Real (Kind=nag_wp) array
Output
-
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:
– Real (Kind=nag_wp) array
Output
-
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:
– Integer
Input
-
On entry: the first dimension of the array
rcm as declared in the (sub)program from which
g13dsf is called.
Constraint:
.
-
16:
– Real (Kind=nag_wp)
Output
-
On exit: the value of the modified portmanteau statistic,
. If
on exit then
chi is returned as zero.
-
17:
– Integer
Output
-
On exit: the number of degrees of freedom of
chi.
-
18:
– 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:
– Integer array
Workspace
-
20:
– Integer
Input
-
On entry: the dimension of the array
iw as declared in the (sub)program from which
g13dsf is called.
Constraint:
.
-
21:
– Real (Kind=nag_wp) array
Workspace
-
22:
– Integer
Input
-
On entry: the dimension of the array
work as declared in the (sub)program from which
g13dsf is called.
Constraint:
if , .
-
23:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 4 in the Introduction to the NAG Library FL Interface 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 arguments 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).
Errors or warnings detected by the routine:
Note: in some cases g13dsf may return useful information.
-
On entry, .
Constraint: .
On entry, and .
Constraint: must not hold.
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, , and .
Constraint: .
On entry, and the minimum size .
Constraint: .
On entry,
and the minimum size
.
Constraint:
lwork must be sufficiently large.
On entry, , and .
Constraint: .
On entry, and .
Constraint: .
-
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.
On entry, the covariance matrix
qq is not positive definite. To proceed you must supply different parameter estimates in the arrays
par and
qq.
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.
-
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.
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.
-
Excessive iterations needed to find zeros of determinental polynomials.
-
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.
-
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
.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
The computations are believed to be stable.
8
Parallelism and Performance
g13dsf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dsf 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 routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
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
10
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.
10.1
Program Text
10.2
Program Data
10.3
Program Results