hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_tsa_uni_autocorr_part (g13ac)

Purpose

nag_tsa_uni_autocorr_part (g13ac) 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.

Syntax

[p, v, ar, nvl, ifail] = g13ac(r, nl, 'nk', nk)
[p, v, ar, nvl, ifail] = nag_tsa_uni_autocorr_part(r, nl, 'nk', nk)

Description

The data consist of values of autocorrelation coefficients r1,r2,,rKr1,r2,,rK, relating to lags 1,2,,K1,2,,K. These will generally (but not necessarily) be sample values such as may be obtained from a time series xtxt using nag_tsa_uni_autocorr (g13ab).
The partial autocorrelation coefficient at lag ll may be identified with the parameter pl,lpl,l in the autoregression
xt = cl + pl,1 xt1 + pl,2 xt2 + + pl,l xtl + el,t
xt = cl + pl,1 xt-1 + pl,2 xt-2 ++ pl,l xt-l + el,t
where el,tel,t is the predictor error.
The first subscript ll of pl,lpl,l and el,tel,t emphasizes the fact that the parameters will in general alter as further terms are introduced into the equation (i.e., as ll is increased).
The parameters are determined from the autocorrelation coefficients by the Yule–Walker equations
ri = pl,1 ri1 + pl,2 ri2 + + pl,l ril ,   i = 1,2,,l
ri = pl,1 ri-1 + pl,2 ri-2 ++ pl,l ri-l ,   i=1,2,,l
taking rj = r|j|rj=r|j| when j < 0j<0, and r0 = 1r0=1.
The predictor error variance ratio vl = var(el,t) / var(xt)vl=var(el,t)/var(xt) is defined by
vl = 1 pl,1 r1 pl,2 r2 pl,l rl .
vl = 1- pl,1 r1 - pl,2 r2 -- pl,l rl .
The above sets of equations are solved by a recursive method (the Durbin–Levinson algorithm). The recursive cycle applied for l = 1,2,,(L1)l=1,2,,(L-1), where LL is the number of partial autocorrelation coefficients required, is initialized by setting p1,1 = r1p1,1=r1 and v1 = 1r12v1=1-r12.
Then
p l + 1 , l + 1 = (r l + 1 p l , 1 rlp l , 2 r l 1 p l , l r1) / vl
p l + 1 , j = p l , j p l + 1 , l + 1 p l , l + 1 j ,   j = 1,2,,l
v l + 1 = vl ( 1 p l + 1 , l + 1 ) (1 + p l + 1 , l + 1 ) .
p l + 1 , l + 1 = ( r l + 1 - p l , 1 r l - p l , 2 r l - 1 - - p l , l r 1 ) / v l p l + 1 , j = p l , j - p l + 1 , l + 1 p l , l + 1 - j ,   j=1,2,,l v l + 1 = v l ( 1 - p l + 1 , l + 1 ) ( 1 + p l + 1 , l + 1 ) .
If the condition |pl,l|1|pl,l|1 occurs, say when l = l0l=l0, 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 pLjpLj, for j = 1,2,,Lj=1,2,,L, or pl01,jpl0-1,j if the recursion has been prematurely halted.

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

Parameters

Compulsory Input Parameters

1:     r(nk) – double array
nk, the dimension of the array, must satisfy the constraint nk > 0nk>0.
The autocorrelation coefficient relating to lag kk, for k = 1,2,,Kk=1,2,,K.
2:     nl – int64int32nag_int scalar
LL, the number of partial autocorrelation coefficients required.
Constraint: 0 < nlnk0<nlnk.

Optional Input Parameters

1:     nk – int64int32nag_int scalar
Default: The dimension of the array r.
KK, the number of lags. The lags range from 11 to KK and do not include zero.
Constraint: nk > 0nk>0.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     p(nl) – double array
p(l)pl contains the partial autocorrelation coefficient at lag ll, pl,lpl,l, for l = 1,2,,nvll=1,2,,nvl.
2:     v(nl) – double array
v(l)vl contains the predictor error variance ratio vlvl, for l = 1,2,,nvll=1,2,,nvl.
3:     ar(nl) – double array
The autoregressive parameters of maximum order, i.e., pLjpLj if ifail = 0ifail=0, or pl01,jpl0-1,j if ifail = 3ifail=3, for j = 1,2,,nvlj=1,2,,nvl.
4:     nvl – int64int32nag_int scalar
The number of valid values in each of p, v and ar. Thus in the case of premature termination at iteration l0l0 (see Section [Description]), nvl is returned as l01l0-1.
5:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,nk0nk0,
ornl0nl0,
ornk < nlnk<nl.
  ifail = 2ifail=2
On entry, the autocorrelation coefficient of lag 11 has an absolute value greater than or equal to 1.01.0; no recursions could be performed.
W ifail = 3ifail=3
Recursion has been prematurely terminated; the supplied autocorrelation coefficients do not form a positive definite sequence (see Section [Description]). Parameter nvl returns the number of valid values computed.

Accuracy

The computations are believed to be stable.

Further Comments

The time taken by nag_tsa_uni_autocorr_part (g13ac) is proportional to (nvl)2 (nvl) 2.

Example

function nag_tsa_uni_autocorr_part_example
r = [0.8004;
     0.4355;
     0.0328;
     -0.2835;
     -0.4505;
     -0.4242;
     -0.2419;
     -0.055;
     0.3783;
     0.5857];
nl = int64(5);
[p, v, ar, nvl, ifail] = nag_tsa_uni_autocorr_part(r, nl)
 

p =

    0.8004
   -0.5708
   -0.2388
   -0.0494
   -0.0321


v =

    0.3594
    0.2423
    0.2284
    0.2279
    0.2276


ar =

    1.1076
   -0.2899
   -0.1925
   -0.0138
   -0.0321


nvl =

                    5


ifail =

                    0


function g13ac_example
r = [0.8004;
     0.4355;
     0.0328;
     -0.2835;
     -0.4505;
     -0.4242;
     -0.2419;
     -0.055;
     0.3783;
     0.5857];
nl = int64(5);
[p, v, ar, nvl, ifail] = g13ac(r, nl)
 

p =

    0.8004
   -0.5708
   -0.2388
   -0.0494
   -0.0321


v =

    0.3594
    0.2423
    0.2284
    0.2279
    0.2276


ar =

    1.1076
   -0.2899
   -0.1925
   -0.0138
   -0.0321


nvl =

                    5


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013