NAG Library Routine Document
G13ACF
1 Purpose
G13ACF calculates partial autocorrelation coefficients given a set of autocorrelation coefficients. It also calculates the predictor error variance ratios for increasing order of finite lag autoregressive predictor, and the autoregressive parameters associated with the predictor of maximum order.
2 Specification
INTEGER |
NK, NL, NVL, IFAIL |
REAL (KIND=nag_wp) |
R(NK), P(NL), V(NL), AR(NL) |
|
3 Description
The data consist of values of autocorrelation coefficients
, relating to lags
. These will generally (but not necessarily) be sample values such as may be obtained from a time series
using
G13ABF.
The partial autocorrelation coefficient at lag
may be identified with the parameter
in the autoregression
where
is the predictor error.
The first subscript of and emphasizes the fact that the parameters will in general alter as further terms are introduced into the equation (i.e., as is increased).
The parameters are determined from the autocorrelation coefficients by the Yule–Walker equations
taking
when
, and
.
The predictor error variance ratio
is defined by
The above sets of equations are solved by a recursive method (the Durbin–Levinson algorithm). The recursive cycle applied for , where is the number of partial autocorrelation coefficients required, is initialized by setting and .
If the condition
occurs, say when
, it indicates that the supplied autocorrelation coefficients do not form a positive definite sequence (see
Hannan (1960)), and the recursion is not continued. The autoregressive parameters are overwritten at each recursive step, so that upon completion the only available values are
, for
, or
if the recursion has been prematurely halted.
4 References
Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Durbin J (1960) The fitting of time series models Rev. Inst. Internat. Stat. 28 233
Hannan E J (1960) Time Series Analysis Methuen
5 Parameters
- 1: R(NK) – REAL (KIND=nag_wp) arrayInput
On entry: the autocorrelation coefficient relating to lag
, for .
- 2: NK – INTEGERInput
On entry: , the number of lags. The lags range from to and do not include zero.
Constraint:
.
- 3: NL – INTEGERInput
On entry: , the number of partial autocorrelation coefficients required.
Constraint:
.
- 4: P(NL) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the partial autocorrelation coefficient at lag , , for .
- 5: V(NL) – REAL (KIND=nag_wp) arrayOutput
On exit: contains the predictor error variance ratio , for .
- 6: AR(NL) – REAL (KIND=nag_wp) arrayOutput
On exit: the autoregressive parameters of maximum order, i.e.,
if , or if , for .
- 7: NVL – INTEGEROutput
On exit: the number of valid values in each of
P,
V and
AR. Thus in the case of premature termination at iteration
(see
Section 3),
NVL is returned as
.
- 8: 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 | . |
On entry, the autocorrelation coefficient of lag has an absolute value greater than or equal to ; no recursions could be performed.
Recursion has been prematurely terminated; the supplied autocorrelation coefficients do not form a positive definite sequence (see
Section 3). Parameter
NVL returns the number of valid values computed.
7 Accuracy
The computations are believed to be stable.
The time taken by G13ACF is proportional to .
9 Example
This example uses an input series of
sample autocorrelation coefficients derived from the original series of sunspot numbers generated by the
G13ABF example program. The results show five values of each of the three output arrays: partial autocorrelation coefficients, predictor error variance ratios and autoregressive parameters. All of these were valid.
9.1 Program Text
Program Text (g13acfe.f90)
9.2 Program Data
Program Data (g13acfe.d)
9.3 Program Results
Program Results (g13acfe.r)