PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_tsa_multi_varma_diag (g13ds)
Purpose
nag_tsa_multi_varma_diag (g13ds) is a diagnostic checking function suitable for use after fitting a vector ARMA model to a multivariate time series using
nag_tsa_multi_varma_estimate (g13dd).
The residual cross-correlation matrices are returned along with an estimate of their asymptotic standard errors and correlations. Also,
nag_tsa_multi_varma_diag (g13ds) calculates the modified Li–McLeod portmanteau statistic and its significance level for testing model adequacy.
Syntax
[
qq,
r0,
r,
rcm,
chi,
idf,
siglev,
ifail] = g13ds(
v,
ip,
iq,
m,
par,
parhld,
qq,
ishow, 'k',
k, 'n',
n)
[
qq,
r0,
r,
rcm,
chi,
idf,
siglev,
ifail] = nag_tsa_multi_varma_diag(
v,
ip,
iq,
m,
par,
parhld,
qq,
ishow, 'k',
k, 'n',
n)
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
nag_tsa_multi_varma_estimate (g13dd)).
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
Choice of .) 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
nag_tsa_multi_varma_diag (g13ds).)
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
Parameters
The output quantities
k,
n,
v,
kmax,
ip,
iq,
par,
parhld and
qq from
nag_tsa_multi_varma_estimate (g13dd) are suitable for input to
nag_tsa_multi_varma_diag (g13ds).
Compulsory Input Parameters
- 1:
– double array
-
kmax, the first dimension of the array, must satisfy the constraint
.
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.
- 2:
– int64int32nag_int scalar
-
, the number of AR parameter matrices.
Constraint:
.
- 3:
– int64int32nag_int scalar
-
, the number of MA parameter matrices.
Constraint:
.
Note: is not permitted.
- 4:
– int64int32nag_int scalar
-
The value of
, the number of residual cross-correlation matrices to be computed. See
Choice of for advice on the choice of
m.
Constraint:
.
- 5:
– double array
-
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.
- 6:
– logical array
-
must be set to true if has been held constant at a pre-specified value and false if is a free parameter, for .
- 7:
– double array
-
kmax, the first dimension of the array, must satisfy the constraint
.
is an efficient estimate of the th element of . The lower triangle only is needed.
Constraint:
must be positive definite.
- 8:
– int64int32nag_int scalar
-
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.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the arrays
v,
qq and the second dimension of the array
qq. (An error is raised if these dimensions are not equal.)
, the number of residual time series.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
v.
, the number of observations in each residual series.
Output Parameters
- 1:
– double array
-
If , then the upper triangle is set equal to the lower triangle.
- 2:
– double array
-
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.
- 3:
– double array
-
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.
- 4:
– double array
-
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
.
- 5:
– double scalar
-
The value of the modified portmanteau statistic,
. If
on exit then
chi is returned as zero.
- 6:
– int64int32nag_int scalar
-
The number of degrees of freedom of
chi.
- 7:
– double scalar
-
The significance level of
chi based on
idf degrees of freedom. If
on exit,
siglev is returned as one.
- 8:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_tsa_multi_varma_diag (g13ds) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
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.
- W
-
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 arguments 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
.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The computations are believed to be stable.
Further Comments
Timing
The time taken by nag_tsa_multi_varma_diag (g13ds) depends upon the number of residual cross-correlation matrices to be computed, , and the number of time series, .
Choice of m
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
.
Checking a ‘White Noise’ Model
If you have fitted the ‘white noise’ model
then
nag_tsa_multi_varma_diag (g13ds) should be entered with
,
, and the first
elements of
par and
parhld set to zero and
true respectively.
Approximate Standard Errors
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.
Alternative 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
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.
Open in the MATLAB editor:
g13ds_example
function g13ds_example
fprintf('g13ds example results\n\n');
w = [ -1.49 -1.62 5.20 6.23 6.21 5.86 4.09 3.18 2.62 1.49 ...
1.17 0.85 -0.35 0.24 2.44 2.58 2.04 0.40 2.26 3.34 ...
5.09 5.00 4.78 4.11 3.45 1.65 1.29 4.09 6.32 7.50 ...
3.89 1.58 5.21 5.25 4.93 7.38 5.87 5.81 9.68 9.07 ...
7.29 7.84 7.55 7.32 7.97 7.76 7.00 8.350;
7.34 6.35 6.96 8.54 6.62 4.97 4.55 4.81 4.75 4.76 ...
10.88 10.01 11.62 10.36 6.40 6.24 7.93 4.04 3.73 5.60 ...
5.35 6.81 8.27 7.68 6.65 6.08 10.25 9.14 17.75 13.30 ...
9.63 6.80 4.08 5.06 4.94 6.65 7.94 10.76 11.89 5.85 ...
9.01 7.50 10.02 10.38 8.15 8.37 10.73 12.14];
[k, n] = size(w);
ip = int64(1);
iq = int64(0);
mean_p = true;
m = int64(10);
iprint = int64(-1);
cgetol = 0.0001;
dishow = int64(2);
ishow = int64(1);
exact = true;
par = zeros(6,1);
parhld = [false; false; true; false; false; false];
qq = zeros(k,k);
[par, qq, niter, rlogl, v, g, cm, ifail] = ...
g13dd( ...
ip, iq, mean_p, par, qq, w, parhld, exact, iprint, cgetol, dishow);
fprintf('\nOutput from g13ds\n\n');
[qq, r0, r, rcm, chi, idf, siglev, ifail] = ...
g13ds( ...
v, ip, iq, m, par, parhld, qq, ishow);
g13ds example results
VALUE OF LOG LIKELIHOOD FUNCTION ON EXIT = -0.20280E+03
MAXIMUM LIKELIHOOD ESTIMATES OF AR PARAMETER MATRICES
-----------------------------------------------------
PHI(1) ROW-WISE : 0.802 0.065
( 0.091)( 0.102)
0.000 0.575
( 0.000)( 0.121)
MAXIMUM LIKELIHOOD ESTIMATE OF PROCESS MEAN
-------------------------------------------
4.271 7.825
( 1.219)( 0.776)
MAXIMUM LIKELIHOOD ESTIMATE OF SIGMA MATRIX
-------------------------------------------
2.964
0.637 5.380
RESIDUAL SERIES NUMBER 1
-------------------------
T 1 2 3 4 5 6 7 8
V(T) -3.33 -1.24 5.75 1.27 0.32 0.11 -1.27 -0.73
T 9 10 11 12 13 14 15 16
V(T) -0.58 -1.26 -0.67 -1.13 -2.02 -0.57 1.24 -0.13
T 17 18 19 20 21 22 23 24
V(T) -0.77 -2.09 1.34 0.95 1.71 0.23 -0.01 -0.60
T 25 26 27 28 29 30 31 32
V(T) -0.68 -1.89 -0.77 2.05 2.11 0.94 -3.32 -2.50
T 33 34 35 36 37 38 39 40
V(T) 3.16 0.47 0.05 2.77 -0.82 0.25 3.99 0.20
T 41 42 43 44 45 46 47 48
V(T) -0.70 1.07 0.44 0.28 1.09 0.50 -0.10 1.70
RESIDUAL SERIES NUMBER 2
-------------------------
T 1 2 3 4 5 6 7 8
V(T) -0.19 -1.20 -0.02 1.21 -1.62 -2.16 -1.63 -1.13
T 9 10 11 12 13 14 15 16
V(T) -1.34 -1.30 4.82 0.43 2.54 0.35 -2.88 -0.77
T 17 18 19 20 21 22 23 24
V(T) 1.02 -3.85 -1.92 0.13 -1.20 0.41 1.03 -0.40
T 25 26 27 28 29 30 31 32
V(T) -1.09 -1.07 3.43 -0.08 9.17 -0.23 -1.34 -2.06
T 33 34 35 36 37 38 39 40
V(T) -3.16 -0.61 -1.30 0.48 0.79 2.87 2.38 -4.31
T 41 42 43 44 45 46 47 48
V(T) 2.32 -1.01 2.38 1.29 -1.14 0.36 2.59 2.64
Output from g13ds
RESIDUAL CROSS-CORRELATION MATRICES
-----------------------------------
LAG 1 : 0.130 0.112
( 0.119)( 0.143)
0.094 0.043
( 0.069)( 0.102)
LAG 2 : -0.312 0.021
( 0.128)( 0.144)
-0.162 0.098
( 0.125)( 0.132)
LAG 3 : 0.004 -0.176
( 0.134)( 0.144)
-0.168 -0.091
( 0.139)( 0.140)
LAG 4 : -0.090 -0.120
( 0.137)( 0.144)
0.099 -0.232
( 0.142)( 0.143)
LAG 5 : 0.041 0.093
( 0.140)( 0.144)
-0.009 -0.089
( 0.144)( 0.144)
LAG 6 : 0.234 -0.008
( 0.141)( 0.144)
0.069 -0.103
( 0.144)( 0.144)
LAG 7 : -0.076 0.007
( 0.142)( 0.144)
0.168 0.000
( 0.144)( 0.144)
LAG 8 : -0.074 0.559
( 0.143)( 0.144)
0.008 -0.101
( 0.144)( 0.144)
LAG 9 : 0.091 0.193
( 0.144)( 0.144)
0.055 0.170
( 0.144)( 0.144)
LAG 10 : -0.060 0.061
( 0.144)( 0.144)
0.191 0.089
( 0.144)( 0.144)
SUMMARY TABLE
-------------
LAGS 1 - 10
***************************
* * *
* .-........ * .......+.. *
* * *
***************************
* * *
* .......... * .......... *
* * *
***************************
LI-MCLEOD PORTMANTEAU STATISTIC = 49.234
SIGNIFICANCE LEVEL = 0.086
(BASED ON 37 DEGREES OF FREEDOM)
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015