NAG Library Routine Document
G13DNF
1 Purpose
G13DNF calculates the sample partial lag correlation matrices of a multivariate time series. A set of
-statistics and their significance levels are also returned. A call to
G13DMF is usually made prior to calling this routine in order to calculate the sample cross-correlation matrices.
2 Specification
SUBROUTINE G13DNF ( |
K, N, M, KMAX, R0, R, MAXLAG, PARLAG, X, PVALUE, WORK, LWORK, IFAIL) |
INTEGER |
K, N, M, KMAX, MAXLAG, LWORK, IFAIL |
REAL (KIND=nag_wp) |
R0(KMAX,K), R(KMAX,KMAX,M), PARLAG(KMAX,KMAX,M), X(M), PVALUE(M), WORK(LWORK) |
|
3 Description
Let
, for
, denote
observations of a vector of
time series. The partial lag correlation matrix at lag
,
, is defined to be the correlation matrix between
and
, after removing the linear dependence on each of the intervening vectors
. It is the correlation matrix between the residual vectors resulting from the regression of
on the carriers
and the regression of
on the same set of carriers; see
Heyse and Wei (1985).
has the following properties.
(i) |
If follows a vector autoregressive model of order , then for ; |
(ii) |
When , reduces to the univariate partial autocorrelation at lag ; |
(iii) |
Each element of is a properly normalized correlation coefficient; |
(iv) |
When , is equal to the cross-correlation matrix at lag (a natural property which also holds for the univariate partial autocorrelation function). |
Sample estimates of the partial lag correlation matrices may be obtained using the recursive algorithm described in
Wei (1990). They are calculated up to lag
, which is usually taken to be at most
. Only the sample cross-correlation matrices (
, for
) and the standard deviations of the series are required as input to G13DNF. These may be computed by
G13DMF. Under the hypothesis that
follows an autoregressive model of order
, the elements of the sample partial lag matrix
, denoted by
, are asymptotically Normally distributed with mean zero and variance
. In addition the statistic
has an asymptotic
-distribution with
degrees of freedom. These quantities,
, are useful as a diagnostic aid for determining whether the series follows an autoregressive model and, if so, of what order.
4 References
Heyse J F and Wei W W S (1985) The partial lag autocorrelation function Technical Report No. 32 Department of Statistics, Temple University, Philadelphia
Wei W W S (1990) Time Series Analysis: Univariate and Multivariate Methods Addison–Wesley
5 Parameters
- 1: K – INTEGERInput
On entry: , the dimension of the multivariate time series.
Constraint:
.
- 2: N – INTEGERInput
On entry: , the number of observations in each series.
Constraint:
.
- 3: M – INTEGERInput
On entry:
, the number of partial lag correlation matrices to be computed. Note this also specifies the number of sample cross-correlation matrices that must be contained in the array
R.
Constraint:
.
- 4: KMAX – INTEGERInput
On entry: the first dimension of the arrays
R0,
R and
PARLAG and the second dimension of the arrays
R and
PARLAG as declared in the (sub)program from which G13DNF is called.
Constraint:
.
- 5: R0(KMAX,K) – REAL (KIND=nag_wp) arrayInput
On entry: if , then must contain the th element of the sample cross-correlation matrix at lag zero, . If , then must contain the standard deviation of the th series.
- 6: R(KMAX,KMAX,M) – REAL (KIND=nag_wp) arrayInput
On entry:
must contain the
th element of the sample cross-correlation at lag
,
, for
,
and
, where series
leads series
(see
Section 8).
- 7: MAXLAG – INTEGEROutput
On exit: the maximum lag up to which partial lag correlation matrices (along with
-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.
- 8: PARLAG(KMAX,KMAX,M) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the th element of the sample partial lag correlation matrix at lag ,
, for , and .
- 9: X(M) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the -statistic at lag , for .
- 10: PVALUE(M) – REAL (KIND=nag_wp) arrayOutput
On exit:
contains the significance level of the corresponding
-statistic in
X, for
.
- 11: WORK(LWORK) – REAL (KIND=nag_wp) arrayWorkspace
- 12: LWORK – INTEGERInput
On entry: the dimension of the array
WORK as declared in the (sub)program from which G13DNF is called.
Constraint:
.
- 13: 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, 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 | . |
The recursive equations used to compute the sample partial lag correlation matrices have broken down at lag
. All output quantities in the arrays
PARLAG,
X and
PVALUE up to and including lag
MAXLAG will be correct.
7 Accuracy
The accuracy will depend upon the accuracy of the sample cross-correlations.
The time taken is roughly proportional to .
If you have calculated the sample cross-correlation matrices in the arrays
R0 and
R, without calling
G13DMF, then care must be taken to ensure they are supplied as described in
Section 5. In particular, for
,
must contain the sample cross-correlation coefficient between
and
.
The routine
G13DBF computes squared partial autocorrelations for a specified number of lags. It may also be used to estimate a sequence of partial autoregression matrices at lags
by making repeated calls to the routine with the parameter
NK set to
. The
th element of the sample partial autoregression matrix at lag
is given by
when
NK is set equal to
on entry to
G13DBF. Note that this is the ‘Yule–Walker’ estimate. Unlike the partial lag correlation matrices computed by G13DNF, when
follows an autoregressive model of order
, the elements of the sample partial autoregressive matrix at lag
do not have variance
, making it very difficult to spot a possible cut-off point. The differences between these matrices are discussed further by
Wei (1990).
Note that
G13DBF takes the sample cross-covariance matrices as input whereas this routine requires the sample cross-correlation matrices to be input.
9 Example
This example computes the sample partial lag correlation matrices of two time series of length , up to lag . The matrices, their -statistics and significance levels and a plot of symbols indicating which elements of the sample partial lag correlation matrices are significant are printed. Three * represent significance at the % level, two * represent significance at the 1% level and a single * represents significance at the 5% level. The * are plotted above or below the central line depending on whether the elements are significant in a positive or negative direction.
9.1 Program Text
Program Text (g13dnfe.f90)
9.2 Program Data
Program Data (g13dnfe.d)
9.3 Program Results
Program Results (g13dnfe.r)