NAG CL Interface
g13acc (uni_autocorr_part)
1
Purpose
g13acc 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 arguments associated with the predictor of maximum order.
2
Specification
void |
g13acc (const double r[],
Integer nk,
Integer nl,
double p[],
double v[],
double ar[],
Integer *nvl,
NagError *fail) |
|
The function may be called by the names: g13acc, nag_tsa_uni_autocorr_part or nag_tsa_auto_corr_part.
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
g13abc.
The partial autocorrelation coefficient at lag
may be identified with the argument
in the autoregression
where
is the predictor error.
The first subscript of and emphasizes the fact that the arguments will in general alter as further terms are introduced into the equation (i.e., as is increased).
The arguments 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
.
Then
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 arguments 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
Arguments
-
1:
– const double
Input
-
On entry: contains the autocorrelation coefficient relating to lag , for .
-
2:
– Integer
Input
-
On entry: the number of lags, . The lags range from 1 to and do not include zero.
Constraint:
.
-
3:
– Integer
Input
-
On entry: the number of partial autocorrelation coefficients required, .
Constraint:
.
-
4:
– double
Output
-
On exit: contains the partial autocorrelation coefficient at lag , , for .
-
5:
– double
Output
-
On exit: contains the predictor error variance ratio , for .
-
6:
– double
Output
-
On exit: the autoregressive arguments of maximum order, i.e., if , or if , for .
-
7:
– Integer *
Output
-
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:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_2_INT_ARG_LT
-
On entry, while . These arguments must satisfy .
- NE_CORR_NOT_POS_DEF
-
Recursion has been prematurely terminated; the supplied autocorrelation coefficients do not form a positive definite sequence. Parameter
nvl returns the number of valid values computed.
- NE_INT_ARG_LE
-
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INVALID_AUTOCO_COEF
-
On entry, the autocorrelation coefficient of lag 1 has an absolute value greater than or equal to 1.0; no recursions could be performed.
7
Accuracy
The computations are believed to be stable.
8
Parallelism and Performance
g13acc is not threaded in any implementation.
The time taken by g13acc is proportional to .
10
Example
In the example below the input series is the set of 10 sample autocorrelation coefficients derived from the original series of sunspot numbers by
g13abc example program. The results show 5 values of each of the three output arrays – partial autocorrelation coefficients, predictor error variance ratios and autoregressive arguments. All of these were valid.
10.1
Program Text
10.2
Program Data
10.3
Program Results