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
. 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
of
and
of
.
The recursive cycle, by which the order of the prediction equation is extended from
to
, is to calculate
then
,
from which
and
Finally,
and
.
(Here denotes the transpose of a matrix.)
The cycle is initialized by taking (for
)
In the step from
to
, the above equations contain redundant terms and simplify. Thus
(1) becomes
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
to
NL.
must contain the cross-covariance,
, of series
and series
at lag
. Series
leads series
.
- 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:
.
- 4: NS – INTEGERInput
On entry:
, the number of time series whose cross-covariances are supplied in
C and
C0.
Constraint:
.
- 5: NL – INTEGERInput
On entry:
, the maximum lag for which cross-covariances are supplied in
C.
Constraint:
.
- 6: NK – INTEGERInput
On entry: the number of lags to which partial auto-correlations are to be calculated.
Constraint:
.
- 7: P(NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the multiple squared partial autocorrelations from lags
to
NVP; that is,
contains
, for
. For lags
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
to
NVP; that is,
contains
, for
. For lags
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
to
NVP.
Element
of
D contains the prediction error covariance of series
and series
at lag
, for
. Series
leads series
; that is, the
th element of
. For lags
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.
contains the backward prediction error covariance of series and series ; that is, the th element of the , where .
- 12: W(LDC0,LDC0,NK) – REAL (KIND=nag_wp) arrayOutput
On exit: the prediction coefficient matrices at lags
to
NVP.
contains the
th prediction coefficient of series
at lag
; that is, the
th element of
, where
, for
. For lags
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
to
NVP.
contains the
th backward prediction coefficient of series
at lag
; that is, the
th element of
, where
, for
. For lags
to
NK the elements of
WB are set to zero.
- 14: NVP – INTEGEROutput
On exit: the maximum lag,
, 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:
.
- 17: 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 | , |
or | . |
C0 is not positive definite.
V0,
V,
P,
D,
DB,
W,
WB and
NVP are set to zero.
At lag
,
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
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.
The time taken by G13DBF is roughly proportional to .
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
(otherwise used to hold the series variances) by
.
9 Example
This example reads the autocovariance matrices for four series from lag to . It calls G13DBF to calculate the multivariate partial autocorrelation function and other related matrices of statistics up to lag . 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)