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_arima_prelim (g13ad)

Purpose

nag_tsa_uni_arima_prelim (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

[par, rv, isf, ifail] = g13ad(mr, r, xv, npar, 'nk', nk)
[par, rv, isf, ifail] = nag_tsa_uni_arima_prelim(mr, r, xv, npar, 'nk', nk)

Description

Preliminary estimates of the pp non-seasonal autoregressive parameters φ1,φ2,,φpϕ1,ϕ2,,ϕp and the qq non-seasonal moving average parameters θ1,θ2,,θqθ1,θ2,,θq may be obtained from the sample autocorrelations relating to lags 11 to p + qp+q, i.e., r1,,rp + qr1,,rp+q, of the differenced dsDxtdsDxt, where xtxt is assumed to follow a (possibly) seasonal ARIMA model (see Section [Description] in (g13ae) for the specification of an ARIMA model).
Taking r0 = 1r0=1 and rk = rkr-k=rk, the φiϕi, for i = 1,2,,pi=1,2,,p are the solutions to the equations
rq + i1 φ1 + rq + i2 φ2 + + rq + ip φp = rq + i ,   i = 1,2,,p.
r q+i-1 ϕ1+ r q+i-2 ϕ2 ++ r q+i-p ϕp = rq+i ,   i=1,2,,p.
The θjθj, for j = 1,2,,qj=1,2,,q, are obtained from the solutions to the equations
cj = τ0τj + τ1τj + 1 + + τq + jτq,   j = 0,1,,q
cj=τ0τj+τ1τj+1++τq+jτq,   j=0,1,,q
(Cramer Wold-factorization), by setting
θj = (τj)/(τ0) ,
θj=-τjτ0 ,
where cjcj are the ‘covariances’ modified in a two stage process by the autoregressive parameters.
Stage 1:
dj = rjφ1rj1φprjp, j = 0,1,,q;
dj = 0, j = q + 1,q + 2,,p + q.
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.
cj=dj-ϕ1dj+ 1-ϕ2dj+ 2--ϕpdj+p,   j= 0,1,,q.
The PP seasonal autoregressive parameters Φ1,Φ2,,ΦPΦ1,Φ2,,ΦP and the QQ seasonal moving average parameters Θ1,Θ2,,ΘQΘ1,Θ2,,ΘQ are estimated in the same way as the non-seasonal parameters, but each rjrj is replaced in the calculation by rs × jrs×j, where ss 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τ02, but otherwise by c0c0.

References

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

Parameters

Compulsory Input Parameters

1:     mr(77) – int64int32nag_int array
The orders vector (p,d,q,P,D,Q,s)(p,d,q,P,D,Q,s) of the ARIMA model whose parameters are to be estimated. pp, qq, PP and QQ refer respectively to the number of autoregressive (φ)(ϕ), moving average (θ)(θ), seasonal autoregressive (Φ)(Φ) and seasonal moving average (Θ)(Θ) parameters. dd, DD and ss 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,s0p,d,q,P,D,Q,s0;
  • p + q + P + Q > 0p+q+P+Q>0;
  • s1s1;
  • if s = 0s=0, P + D + Q = 0P+D+Q=0;
  • if s > 1s>1, P + D + Q > 0P+D+Q>0.
2:     r(nk) – double array
nk, the dimension of the array, must satisfy the constraint nkmax (p + q,s × (P + Q))nkmax(p+q,s×(P+Q)).
The autocorrelations (starting at lag 11), which must have been calculated after the time series has been appropriately differenced.
Constraint: 1.0r(i)1.0-1.0ri1.0, for i = 1,2,,nki=1,2,,nk.
3:     xv – double scalar
The series sample variance, calculated after appropriate differencing has been applied to the series.
Constraint: xv > 0.0xv>0.0.
4:     npar – int64int32nag_int scalar
The exact number of parameters specified in the model by array mr.
Constraint: npar = p + q + P + Qnpar=p+q+P+Q.

Optional Input Parameters

1:     nk – int64int32nag_int scalar
Default: The dimension of the array r.
The maximum lag of the autocorrelations in array r.
Constraint: nkmax (p + q,s × (P + Q))nkmax(p+q,s×(P+Q)).

Input Parameters Omitted from the MATLAB Interface

wa nwa

Output Parameters

1:     par(npar) – double array
The first npar elements of par contain the preliminary estimates of the ARIMA model parameters, in standard order.
2:     rv – double scalar
An estimate of the residual variance of the preliminarily estimated model.
3:     isf(44) – int64int32nag_int array
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-0 No parameter of this type is in the model.
1-1 Parameters of this type appear in the model and satisfactory preliminary estimates of this type were obtained.
1-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.00.0 in array par.
4:     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, the orders vector mr is invalid. One of the constraints in Section [Parameters] has been violated.
  ifail = 2ifail=2
On entry, nk < max (p + q,s × (P + Q))nk<max(p+q,s×(P+Q)). There are not enough autocorrelations to enable the required model to be estimated.
  ifail = 3ifail=3
On entry,at least one element of r lies outside the range [1.0,1.0][-1.0,1.0].
  ifail = 4ifail=4
On entry,xv0.0xv0.0.
  ifail = 5ifail=5
On entry,nparp + q + P + Qnparp+q+P+Q.
  ifail = 6ifail=6
On entry,the workspace array wa is too small. See Section [Parameters] for the minimum size formula.
W ifail = 7ifail=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.

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, ee, should satisfy e < 100εe<100ε where εε is machine precision.

Further Comments

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

Example

function nag_tsa_uni_arima_prelim_example
mr = [int64(0);1;1;0;1;1;12];
r = [-0.32804;
     0.0985;
     -0.21854;
     0.05585;
     0.04679;
     0.04135;
     -0.07989;
     0.00335;
     0.13973;
     -0.04022;
     0.07618;
     -0.40583;
     0.18239;
     -0.05057;
     0.16094;
     -0.159;
     0.09152;
     -0.03474;
     0.05195;
     -0.14417;
     0.04264;
     -0.0817;
     0.23389;
     -0.02828;
     -0.09001;
     0.0305;
     -0.02046;
     0.05522;
     -0.02048;
     -0.06651;
     -0.0294;
     0.20204;
     -0.13953;
     0.10098;
     -0.20849;
     0.03338;
     0.00829;
     0.07082;
     -0.04457;
     -0.01216];
xv = 0.00213;
npar = int64(2);
[par, rv, isf, ifail] = nag_tsa_uni_arima_prelim(mr, r, xv, npar)
 

par =

    0.3739
    0.5124


rv =

    0.0015


isf =

                    0
                    1
                    0
                    1


ifail =

                    0


function g13ad_example
mr = [int64(0);1;1;0;1;1;12];
r = [-0.32804;
     0.0985;
     -0.21854;
     0.05585;
     0.04679;
     0.04135;
     -0.07989;
     0.00335;
     0.13973;
     -0.04022;
     0.07618;
     -0.40583;
     0.18239;
     -0.05057;
     0.16094;
     -0.159;
     0.09152;
     -0.03474;
     0.05195;
     -0.14417;
     0.04264;
     -0.0817;
     0.23389;
     -0.02828;
     -0.09001;
     0.0305;
     -0.02046;
     0.05522;
     -0.02048;
     -0.06651;
     -0.0294;
     0.20204;
     -0.13953;
     0.10098;
     -0.20849;
     0.03338;
     0.00829;
     0.07082;
     -0.04457;
     -0.01216];
xv = 0.00213;
npar = int64(2);
[par, rv, isf, ifail] = g13ad(mr, r, xv, npar)
 

par =

    0.3739
    0.5124


rv =

    0.0015


isf =

                    0
                    1
                    0
                    1


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