NAG Library Routine Document
g13dbf
(multi_autocorr_part)
1
Purpose
g13dbf calculates the multivariate partial autocorrelation function of a multivariate time series.
2
Specification
Fortran Interface
Subroutine g13dbf ( |
c0,
c,
ldc0,
ns,
nl,
nk,
p,
v0,
v,
d,
db,
w,
wb,
nvp,
wa,
iwa,
ifail) |
Integer, Intent (In) | :: |
ldc0,
ns,
nl,
nk,
iwa | Integer, Intent (Inout) | :: |
ifail | Integer, Intent (Out) | :: |
nvp | Real (Kind=nag_wp), Intent (In) | :: |
c0(ldc0,ns),
c(ldc0,ldc0,nl) | Real (Kind=nag_wp), Intent (Inout) | :: |
d(ldc0,ldc0,nk),
db(ldc0,ns),
w(ldc0,ldc0,nk),
wb(ldc0,ldc0,nk) | Real (Kind=nag_wp), Intent (Out) | :: |
p(nk),
v0,
v(nk),
wa(iwa) |
|
C Header Interface
#include nagmk26.h
void |
g13dbf_ (
const double c0[],
const double c[],
const Integer *ldc0,
const Integer *ns,
const Integer *nl,
const Integer *nk,
double p[],
double *v0,
double v[],
double d[],
double db[],
double w[],
double wb[],
Integer *nvp,
double wa[],
const Integer *iwa,
Integer *ifail) |
|
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
Arguments
- 1: – 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: – 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: – 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: – IntegerInput
-
On entry:
, the number of time series whose cross-covariances are supplied in
c and
c0.
Constraint:
.
- 5: – IntegerInput
-
On entry:
, the maximum lag for which cross-covariances are supplied in
c.
Constraint:
.
- 6: – IntegerInput
-
On entry: the number of lags to which partial auto-correlations are to be calculated.
Constraint:
.
- 7: – 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: – Real (Kind=nag_wp)Output
-
On exit: the lag zero prediction error variance (equal to the determinant of
c0).
- 9: – 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: – 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: – 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: – 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: – 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: – 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: – Real (Kind=nag_wp) arrayWorkspace
- 16: – IntegerInput
-
On entry: the dimension of the array
wa as declared in the (sub)program from which
g13dbf is called.
Constraint:
.
- 17: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
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
Parallelism and Performance
g13dbf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13dbf 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 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
.
10
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.
10.1
Program Text
Program Text (g13dbfe.f90)
10.2
Program Data
Program Data (g13dbfe.d)
10.3
Program Results
Program Results (g13dbfe.r)