g13ac Method
関数リスト一覧   NagLibrary Namespaceへ  ライブラリイントロダクション  本ヘルプドキュメントのchm形式版

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 (Declaration)
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 (see [Error Indicators and Warnings]).

Description

The partial autocorrelation coefficient at lag l may be identified with the parameter pl,l in the autoregression
xt = cl + pl,1 xt-1 + pl,2 xt-2 ++ pl,l xt-l + el,t
where el,t is the predictor error.
The first subscript l of pl,l and el,t emphasises 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,1 ri-1 + pl,2 ri-2 ++ pl,l ri-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,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,,L-1, where L is the number of partial autocorrelation coefficients required, is initialized by setting p1,1=r1 and v1=1-r12.
Then
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,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

Error Indicators and Warnings

Accuracy

Further Comments

The time taken by g13ac is proportional to nvl 2.

Example

This example uses an input series of 10 sample autocorrelation coefficients derived from the original series of sunspot numbers generated by the g13ab 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.

Example program (C#): g13ace.cs

Example program data: g13ace.d

Example program results: g13ace.r

See Also