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

C#
public static void g13ac(
	double[] r,
	int nk,
	int nl,
	double[] p,
	double[] v,
	double[] ar,
	out int nvl,
	out int ifail
)
Visual Basic
Public Shared Sub g13ac ( _
	r As Double(), _
	nk As Integer, _
	nl As Integer, _
	p As Double(), _
	v As Double(), _
	ar As Double(), _
	<OutAttribute> ByRef nvl As Integer, _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g13ac(
	array<double>^ r, 
	int nk, 
	int nl, 
	array<double>^ p, 
	array<double>^ v, 
	array<double>^ ar, 
	[OutAttribute] int% nvl, 
	[OutAttribute] int% ifail
)
F#
static member g13ac : 
        r : float[] * 
        nk : int * 
        nl : int * 
        p : float[] * 
        v : float[] * 
        ar : float[] * 
        nvl : int byref * 
        ifail : int byref -> unit 

Parameters

r
Type: array<System..::..Double>[]()[][]
An array of size [nk]
On entry: the autocorrelation coefficient relating to lag k, for k=1,2,,K.
nk
Type: System..::..Int32
On entry: K, the number of lags. The lags range from 1 to K and do not include zero.
Constraint: nk>0.
nl
Type: System..::..Int32
On entry: L, the number of partial autocorrelation coefficients required.
Constraint: 0<nlnk.
p
Type: array<System..::..Double>[]()[][]
An array of size [nl]
On exit: p[l-1] contains the partial autocorrelation coefficient at lag l, pl,l, for l=1,2,,nvl.
v
Type: array<System..::..Double>[]()[][]
An array of size [nl]
On exit: v[l-1] contains the predictor error variance ratio vl, for l=1,2,,nvl.
ar
Type: array<System..::..Double>[]()[][]
An array of size [nl]
On exit: the autoregressive parameters of maximum order, i.e., pLj if ifail=0, or pl0-1,j if ifail=3, for j=1,2,,nvl.
nvl
Type: System..::..Int32%
On exit: the number of valid values in each of p, v and ar. Thus in the case of premature termination at iteration l0 (see [Description]), nvl is returned as l0-1.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

The data consist of values of autocorrelation coefficients r1,r2,,rK, relating to lags 1,2,,K. These will generally (but not necessarily) be sample values such as may be obtained from a time series xt using g13ab.
The partial autocorrelation coefficient at lag l may be identified with the parameter pl,l in the autoregression
xt=cl+pl,1xt-1+pl,2xt-2++pl,lxt-l+el,t
where el,t is the predictor error.
The first subscript l of pl,l and el,t emphasizes the fact that the parameters will in general alter as further terms are introduced into the equation (i.e., as l is increased).
The parameters are determined from the autocorrelation coefficients by the Yule–Walker equations
ri=pl,1ri-1+pl,2ri-2++pl,lri-l,  i=1,2,,l
taking rj=rj when j<0, and r0=1.
The predictor error variance ratio vl=varel,t/varxt is defined by
vl=1-pl,1r1-pl,2r2--pl,lrl.
The above sets of equations are solved by a recursive method (the Durbin–Levinson algorithm). The recursive cycle applied for l=1,2,,L-1, where L is the number of partial autocorrelation coefficients required, is initialized by setting p1,1=r1 and v1=1-r12.
Then
pl+1,l+1=rl+1-pl,1rl-pl,2rl-1--pl,lr1/vlpl+1,j=pl,j-pl+1,l+1pl,l+1-j,  j=1,2,,lvl+1=vl1-pl+1,l+11+pl+1,l+1.
If the condition pl,l1 occurs, say when l=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 pLj, for j=1,2,,L, or pl0-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

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=1
On entry,nk0,
ornl0,
ornk<nl.
ifail=2
On entry, the autocorrelation coefficient of lag 1 has an absolute value greater than or equal to 1.0; no recursions could be performed.
ifail=3
Recursion has been prematurely terminated; the supplied autocorrelation coefficients do not form a positive definite sequence (see [Description]). Parameter nvl returns the number of valid values computed.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The computations are believed to be stable.

Parallelism and Performance

None.

Further Comments

The time taken by g13ac is proportional to nvl2.

Example

See Also