NAG Library Routine Document
G13DBF
1 Purpose
G13DBF calculates the multivariate partial autocorrelation function of a multivariate time series.
2 Specification
SUBROUTINE G13DBF ( |
C0, C, LDC0, NS, NL, NK, P, V0, V, D, DB, W, WB, NVP, WA, IWA, IFAIL) |
INTEGER |
LDC0, NS, NL, NK, NVP, IWA, IFAIL |
REAL (KIND=nag_wp) |
C0(LDC0,NS), C(LDC0,LDC0,NL), P(NK), V0, V(NK), D(LDC0,LDC0,NK), DB(LDC0,NS), W(LDC0,LDC0,NK), WB(LDC0,LDC0,NK), WA(IWA) |
|
3 Description
The input is a set of lagged autocovariance matrices
C0,C1,C2,…,Cm. These will generally be sample values such as are obtained from a multivariate time series using
G13DMF.
The main calculation is the recursive determination of the coefficients in the finite lag (forward) prediction equation
and the associated backward prediction equation
together with the covariance matrices
Dl of
el,t and
Gl of
fl,t.
The recursive cycle, by which the order of the prediction equation is extended from
l to
l+1, is to calculate
then
Φ
l+1,l+1
=
Ml+1
Dl-1
,
Ψ
l+1,l+1
=
MT
l+1
Gl-1
from which
and
Finally,
Dl+1=Dl-Ml+1ΦTl+1,l+1 and
Gl+1=Gl-MTl+1ΨTl+1,l+1.
(Here T denotes the transpose of a matrix.)
The cycle is initialized by taking (for
l=0)
In the step from
l=0 to
1, the above equations contain redundant terms and simplify. Thus
(1) becomes
M1=CT1 and neither
(2) or
(3) are needed.
Quantities useful in assessing the effectiveness of the prediction equation are generalized variance ratios
and multiple squared partial autocorrelations
4 References
Akaike H (1971) Autoregressive model fitting for control
Ann. Inst. Statist. Math. 23 163–180
Whittle P (1963) On the fitting of multivariate autoregressions and the approximate canonical factorization of a spectral density matrix
Biometrika 50 129–134
5 Parameters
- 1: C0(LDC0,NS) – REAL (KIND=nag_wp) arrayInput
On entry: contains the zero lag cross-covariances between the
NS series as returned by
G13DMF. (
C0 is assumed to be symmetric, upper triangle only is used.)
- 2: C(LDC0,LDC0,NL) – REAL (KIND=nag_wp) arrayInput
On entry: contains the cross-covariances at lags
1 to
NL.
Cijk must contain the cross-covariance,
cijk, of series
i and series
j at lag
k. Series
j leads series
i.
- 3: LDC0 – INTEGERInput
On entry: the first dimension of the arrays
C0,
C,
D,
DB,
W and
WB and the second dimension of the arrays
C,
D,
W and
WB as declared in the (sub)program from which G13DBF is called.
Constraint:
LDC0≥maxNS,1.
- 4: NS – INTEGERInput
On entry:
k, the number of time series whose cross-covariances are supplied in
C and
C0.
Constraint:
NS≥1.
- 5: NL – INTEGERInput
On entry:
m, the maximum lag for which cross-covariances are supplied in
C.
Constraint:
NL≥1.
- 6: NK – INTEGERInput
On entry: the number of lags to which partial auto-correlations are to be calculated.
Constraint:
1≤NK≤NL.
- 7: P(NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the multiple squared partial autocorrelations from lags
1 to
NVP; that is,
Pl contains
pl2, for
l=1,2,…,NVP. For lags
NVP+1 to
NK the elements of
P are set to zero.
- 8: V0 – REAL (KIND=nag_wp)Output
On exit: the lag zero prediction error variance (equal to the determinant of
C0).
- 9: V(NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the prediction error variance ratios from lags
1 to
NVP; that is,
Vl contains
vl, for
l=1,2,…,NVP. For lags
NVP+1 to
NK the elements of
V are set to zero.
- 10: D(LDC0,LDC0,NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the prediction error variance matrices at lags
1 to
NVP.
Element
i,j,k of
D contains the prediction error covariance of series
i and series
j at lag
k, for
k=1,2,…,NVP. Series
j leads series
i; that is, the
i,jth element of
Dk. For lags
NVP+1 to
NK the elements of
D are set to zero.
- 11: DB(LDC0,NS) – REAL (KIND=nag_wp) arrayOutput
On exit: the backward prediction error variance matrix at lag
NVP.
DBij contains the backward prediction error covariance of series i and series j; that is, the i,jth element of the Gk, where k=NVP.
- 12: W(LDC0,LDC0,NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the prediction coefficient matrices at lags
1 to
NVP.
Wijl contains the
jth prediction coefficient of series
i at lag
l; that is, the
i,jth element of
Φkl, where
k=NVP, for
l=1,2,…,NVP. For lags
NVP+1 to
NK the elements of
W are set to zero.
- 13: WB(LDC0,LDC0,NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the backward prediction coefficient matrices at lags
1 to
NVP.
WBijl contains the
jth backward prediction coefficient of series
i at lag
l; that is, the
i,jth element of
Ψkl, where
k=NVP, for
l=1,2,…,NVP. For lags
NVP+1 to
NK the elements of
WB are set to zero.
- 14: NVP – INTEGEROutput
On exit: the maximum lag,
L, for which calculation of
P,
V,
D,
DB,
W and
WB was successful. If the routine completes successfully
NVP will equal
NK.
- 15: WA(IWA) – REAL (KIND=nag_wp) arrayWorkspace
- 16: IWA – INTEGERInput
On entry: the dimension of the array
WA as declared in the (sub)program from which G13DBF is called.
Constraint:
IWA≥2×NS+1×NS.
- 17: IFAIL – INTEGERInput/Output
-
On entry:
IFAIL must be set to
0,
-1 or 1. 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
-1 or 1 is recommended. If the output of error messages is undesirable, then the value
1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
0.
When the value -1 or 1 is used it is essential to test the value of IFAIL on exit.
On exit:
IFAIL=0 unless the routine detects an error or a warning has been flagged (see
Section 6).
6 Error Indicators and Warnings
If on entry
IFAIL=0 or
-1, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Errors or warnings detected by the routine:
- IFAIL=1
On entry, | LDC0<1, |
or | NS<1, |
or | NS>LDC0, |
or | NL<1, |
or | NK<1, |
or | NK>NL, |
or | IWA<2×NS+1×NS. |
- IFAIL=2
C0 is not positive definite.
V0,
V,
P,
D,
DB,
W,
WB and
NVP are set to zero.
- IFAIL=3
At lag
k=NVP+1≤NK,
Dk was found not to be positive definite. Up to lag
NVP,
V0,
V,
P,
D,
W and
WB contain the values calculated so far and from lag
NVP+1 to lag
NK the matrices contain zero.
DB contains the backward prediction coefficients for lag
NVP.
7 Accuracy
The conditioning of the problem depends on the prediction error variance ratios. Very small values of these may indicate loss of accuracy in the computations.
8 Further Comments
The time taken by G13DBF is roughly proportional to NK2×NS3.
If sample autocorrelation matrices are used as input, then the output will be relevant to the original series scaled by their standard deviations. If these autocorrelation matrices are produced by
G13DMF, you must replace the diagonal elements of
C0 (otherwise used to hold the series variances) by
1.
9 Example
This example reads the autocovariance matrices for four series from lag 0 to 5. It calls G13DBF to calculate the multivariate partial autocorrelation function and other related matrices of statistics up to lag 3. It prints the results.
9.1 Program Text
Program Text (g13dbfe.f90)
9.2 Program Data
Program Data (g13dbfe.d)
9.3 Program Results
Program Results (g13dbfe.r)