g13ad calculates preliminary estimates of the parameters of an autoregressive integrated moving average (ARIMA) model from the autocorrelation function of the appropriately differenced times series.

Syntax

C#
public static void g13ad(
	int[] mr,
	double[] r,
	int nk,
	double xv,
	double[] par,
	out double rv,
	int[] isf,
	out int ifail
)
Visual Basic
Public Shared Sub g13ad ( _
	mr As Integer(), _
	r As Double(), _
	nk As Integer, _
	xv As Double, _
	par As Double(), _
	<OutAttribute> ByRef rv As Double, _
	isf As Integer(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g13ad(
	array<int>^ mr, 
	array<double>^ r, 
	int nk, 
	double xv, 
	array<double>^ par, 
	[OutAttribute] double% rv, 
	array<int>^ isf, 
	[OutAttribute] int% ifail
)
F#
static member g13ad : 
        mr : int[] * 
        r : float[] * 
        nk : int * 
        xv : float * 
        par : float[] * 
        rv : float byref * 
        isf : int[] * 
        ifail : int byref -> unit 

Parameters

mr
Type: array<System..::..Int32>[]()[][]
An array of size [7]
On entry: the orders vector p,d,q,P,D,Q,s of the ARIMA model whose parameters are to be estimated. p, q, P and Q refer respectively to the number of autoregressive ϕ, moving average θ, seasonal autoregressive Φ and seasonal moving average Θ parameters. d, D and s refer respectively to the order of non-seasonal differencing, the order of seasonal differencing and the seasonal period.
Constraints:
  • p,d,q,P,D,Q,s0;
  • p+q+P+Q>0;
  • s1;
  • if s=0, P+D+Q=0;
  • if s>1, P+D+Q>0.
r
Type: array<System..::..Double>[]()[][]
An array of size [nk]
On entry: the autocorrelations (starting at lag 1), which must have been calculated after the time series has been appropriately differenced.
Constraint: -1.0r[i]1.0, for i=0,1,,nk-1.
nk
Type: System..::..Int32
On entry: the maximum lag of the autocorrelations in array r.
Constraint: nkmaxp+q,s×P+Q.
xv
Type: System..::..Double
On entry: the series sample variance, calculated after appropriate differencing has been applied to the series.
Constraint: xv>0.0.
par
Type: array<System..::..Double>[]()[][]
An array of size [dim1]
Note: dim1 must satisfy the constraint: _npar=p+q+P+Q
On exit: the first _npar elements of par contain the preliminary estimates of the ARIMA model parameters, in standard order.
rv
Type: System..::..Double%
On exit: an estimate of the residual variance of the preliminarily estimated model.
isf
Type: array<System..::..Int32>[]()[][]
An array of size [4]
On exit: contains success/failure indicators, one for each of the four types of parameter (autoregressive, moving average, seasonal autoregressive, seasonal moving average).
The indicator has the interpretation:
-0 No parameter of this type is in the model.
-1 Parameters of this type appear in the model and satisfactory preliminary estimates of this type were obtained.
-1 Parameters of this type appear in the model but satisfactory preliminary estimates of this type were not obtainable. The estimates of this type of parameter were set to 0.0 in array par.
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

Preliminary estimates of the p non-seasonal autoregressive parameters ϕ1,ϕ2,,ϕp and the q non-seasonal moving average parameters θ1,θ2,,θq may be obtained from the sample autocorrelations relating to lags 1 to p+q, i.e., r1,,rp+q, of the differenced dsDxt, where xt is assumed to follow a (possibly) seasonal ARIMA model (see [Description] in g13ae for the specification of an ARIMA model).
Taking r0=1 and r-k=rk, the ϕi, for i=1,2,,p are the solutions to the equations
rq+i-1ϕ1+rq+i-2ϕ2++rq+i-pϕp=rq+i,  i=1,2,,p.
The θj, for j=1,2,,q, are obtained from the solutions to the equations
cj=τ0τj+τ1τj+1++τq+jτq,  j=0,1,,q
(Cramer Wold-factorization), by setting
θj=-τjτ0,
where cj are the ‘covariances’ modified in a two stage process by the autoregressive parameters.
Stage 1:
dj=rj-ϕ1rj-1--ϕprj-p,j=0,1,,q;dj=0,j=q+1,q+2,,p+q.
Stage 2:
cj=dj-ϕ1dj+1-ϕ2dj+2--ϕpdj+p,  j=0,1,,q.
The P seasonal autoregressive parameters Φ1,Φ2,,ΦP and the Q seasonal moving average parameters Θ1,Θ2,,ΘQ are estimated in the same way as the non-seasonal parameters, but each rj is replaced in the calculation by rs×j, where s is the seasonal period.
An estimate of the residual variance is obtained by successively reducing the sample variance, first for non-seasonal, and then for seasonal, parameter estimates. If moving average parameters are estimated, the variance is reduced by a multiplying factor of τ02, but otherwise by c0.

References

Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (NPAR) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry, the orders vector mr is invalid. One of the constraints in [Parameters] has been violated.
ifail=2
On entry, nk<maxp+q,s×P+Q. There are not enough autocorrelations to enable the required model to be estimated.
ifail=3
On entry,at least one element of r lies outside the range -1.0,1.0.
ifail=4
On entry,xv0.0.
ifail=6
On entry,the workspace array wa is too small. See [Parameters] for the minimum size formula.
ifail=7
Satisfactory parameter estimates could not be obtained for all parameter types in the model. Inspect array isf for indicators of the parameter type(s) which could not be estimated.
ifail=-9000
An error occured, see message report.
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

The performance of the algorithm is conditioned by the roots of the autoregressive and moving average operators. If these are not close to unity in modulus, the errors, e, should satisfy e<100ε where ε is machine precision.

Parallelism and Performance

None.

Further Comments

The time taken by g13ad is approximately proportional to p3+q2+P3+Q2.

Example

This example reads the sample autocorrelations to lag 40 and the sample variance of the lagged and doubly differenced series of airline passenger totals (Box and Jenkins example series G (see Box and Jenkins (1976))). Preliminary estimates of the parameters of the 0,1,1,0,1,1,12 model are obtained by a call to g13ad.

Example program (C#): g13ade.cs

Example program data: g13ade.d

Example program results: g13ade.r

See Also