NAG Library Routine Document
G13DPF
1 Purpose
G13DPF calculates the sample partial autoregression matrices of a multivariate time series. A set of likelihood ratio statistics and their significance levels are also returned. These quantities are useful for determining whether the series follows an autoregressive model and, if so, of what order.
2 Specification
SUBROUTINE G13DPF ( |
K, N, Z, KMAX, M, MAXLAG, PARLAG, SE, QQ, X, PVALUE, LOGLHD, WORK, LWORK, IWORK, IFAIL) |
INTEGER |
K, N, KMAX, M, MAXLAG, LWORK, IWORK(K*M), IFAIL |
REAL (KIND=nag_wp) |
Z(KMAX,N), PARLAG(KMAX,KMAX,M), SE(KMAX,KMAX,M), QQ(KMAX,KMAX,M), X(M), PVALUE(M), LOGLHD(M), WORK(LWORK) |
|
3 Description
Let , for , denote a vector of time series. The partial autoregression matrix at lag , , is defined to be the last matrix coefficient when a vector autoregressive model of order is fitted to the series. has the property that if follows a vector autoregressive model of order then for .
Sample estimates of the partial autoregression matrices may be obtained by fitting autoregressive models of successively higher orders by multivariate least squares; see
Tiao and Box (1981) and
Wei (1990). These models are fitted using a
algorithm based on the routines
G02DCF and
G02DFF. They are calculated up to lag
, which is usually taken to be at most
.
The routine also returns the asymptotic standard errors of the elements of
and an estimate of the residual variance-covariance matrix
, for
. If
denotes the residual sum of squares and cross-products matrix after fitting an
model to the series then under the null hypothesis
the test statistic
is asymptotically distributed as
with
degrees of freedom.
provides a useful diagnostic aid in determining the order of an autoregressive model. (Note that
.) The routine also returns an estimate of the maximum of the log-likelihood function for each AR model that has been fitted.
4 References
Tiao G C and Box G E P (1981) Modelling multiple time series with applications J. Am. Stat. Assoc. 76 802–816
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley
5 Parameters
- 1: – INTEGERInput
-
On entry: , the number of time series.
Constraint:
.
- 2: – INTEGERInput
-
On entry: , the number of observations in the time series.
Constraint:
.
- 3: – REAL (KIND=nag_wp) arrayInput
-
On entry: must contain the observation , for and .
- 4: – INTEGERInput
-
On entry: the first dimension of the arrays
Z,
PARLAG,
SE and
QQ and the second dimension of the arrays
PARLAG,
SE and
QQ as declared in the (sub)program from which G13DPF is called.
Constraint:
.
- 5: – INTEGERInput
-
On entry: , the number of partial autoregression matrices to be computed. If in doubt set .
Constraint:
and .
- 6: – INTEGEROutput
-
On exit: the maximum lag up to which partial autoregression matrices (along with their likelihood ratio statistics and their significance levels) have been successfully computed. On a successful exit
MAXLAG will equal
M. If
on exit then
MAXLAG will be less than
M.
- 7: – REAL (KIND=nag_wp) arrayOutput
-
On exit: contains an estimate of the th element of the partial autoregression matrix at lag , , for , and .
- 8: – REAL (KIND=nag_wp) arrayOutput
-
On exit:
contains an estimate of the standard error of the corresponding element in the array
PARLAG.
- 9: – REAL (KIND=nag_wp) arrayOutput
-
On exit: contains an estimate of the th element of the corresponding variance-covariance matrix , for , and .
- 10: – REAL (KIND=nag_wp) arrayOutput
-
On exit: contains , the likelihood ratio statistic at lag , for .
- 11: – REAL (KIND=nag_wp) arrayOutput
-
On exit:
contains the significance level of the statistic in the corresponding element of
X.
- 12: – REAL (KIND=nag_wp) arrayOutput
-
On exit: contains an estimate of the maximum of the log-likelihood function when an model has been fitted to the series, for .
- 13: – REAL (KIND=nag_wp) arrayWorkspace
- 14: – INTEGERInput
-
On entry: the dimension of the array
WORK as declared in the (sub)program from which G13DPF is called.
Constraint:
, where .
- 15: – INTEGER arrayWorkspace
-
- 16: – 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, if you are not familiar with this parameter, 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:
-
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | LWORK is too small. |
-
The recursive equations used to compute the sample partial autoregression matrices have broken down at lag
. This exit could occur if the regression model is overparameterised. For your settings of
and
the value returned by
MAXLAG is the largest permissible value of
for which the model is not overparameterised. All output quantities in the arrays
PARLAG,
SE,
QQ,
X,
PVALUE and
LOGLHD up to and including lag
MAXLAG will be correct.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
The computations are believed to be stable.
8 Parallelism and Performance
G13DPF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G13DPF 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 is roughly proportional to .
For each order of autoregressive model that has been estimated, G13DPF returns the maximum of the log-likelihood function. An alternative means of choosing the order of a vector AR process is to choose the order for which Akaike's information criterion is smallest. That is, choose the value of for which is smallest. You should be warned that this does not always lead to the same choice of as indicated by the sample partial autoregression matrices and the likelihood ratio statistics.
10 Example
This example computes the sample partial autoregression matrices of two time series of length up to lag .
10.1 Program Text
Program Text (g13dpfe.f90)
10.2 Program Data
Program Data (g13dpfe.d)
10.3 Program Results
Program Results (g13dpfe.r)