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_forcecast (g13aj)

Purpose

nag_tsa_uni_arima_forcecast (g13aj) applies a fully specified seasonal ARIMA model to an observed time series, generates the state set for forecasting and (optionally) derives a specified number of forecasts together with their standard deviations.

Syntax

[rms, st, nst, fva, fsd, isf, ifail] = g13aj(mr, par, c, kfc, x, ist, nfv, ifv, 'npar', npar, 'nx', nx)
[rms, st, nst, fva, fsd, isf, ifail] = nag_tsa_uni_arima_forcecast(mr, par, c, kfc, x, ist, nfv, ifv, 'npar', npar, 'nx', nx)

Description

The time series x1,x2,,xnx1,x2,,xn supplied to the function is assumed to follow a seasonal autoregressive integrated moving average (ARIMA) model with known parameters.
The model is defined by the following relations.
(a) dsDxtc = wtdsDxt-c=wt where dsDxtdsDxt is the result of applying non-seasonal differencing of order dd and seasonal differencing of seasonality ss and order DD to the series xtxt, and cc is a constant.
(b) wt = Φ1wts + Φ2wt2 × s + + ΦPwtP × s + etΘ1etsΘ2et2 × sΘQetQ × s.wt=Φ1wt-s+Φ2wt-2×s++ΦPwt-P×s+et-Θ1et-s-Θ2et-2×s--ΘQet-Q×s. 
This equation describes the seasonal structure with seasonal period ss; in the absence of seasonality it reduces to wt = etwt=et.
(c) et = φ1et1 + φ2et2 + + φpetp + atθ1at1θ2at2θqatq.et=ϕ1et-1+ϕ2et-2++ϕpet-p+at-θ1at-1-θ2at-2--θqat-q. 
This equation describes the non-seasonal structure.
Given the series, the constant cc, and the model parameters ΦΦ, ΘΘ, φϕ, θθ, the function computes the following.
(a) The state set required for forecasting. This contains the minimum amount of information required for forecasting and comprises:
(i) the differenced series wtwt, for (Ns × P)tN(N-s×P)tN;
(ii) the (d + D × s)(d+D×s) values required to reconstitute the original series xtxt from the differenced series wtwt;
(iii) the intermediate series etet, for Nmax (p,Q × s) < tNN-max(p,Q×s)<tN;
(iv) the residual series atat, for (Nq) < tN(N-q)<tN, where N = n(d + D × s)N=n-(d+D×s).
(b) A set of LL forecasts of xtxt and their estimated standard errors, stst, for t = n + 1,,n + Lt=n+1,,n+L (LL may be zero).
The forecasts and estimated standard errors are generated from the state set, and are identical to those that would be produced from the same state set by nag_tsa_uni_arima_forecast_state (g13ah).
Use of nag_tsa_uni_arima_forcecast (g13aj) should be confined to situations in which the state set for forecasting is unknown. Forecasting from the series requires recalculation of the state set and this is relatively expensive.

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, in the usual notation.
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;
  • d + s × (P + D)nd+s×(P+D)n;
  • p + dq + s × (P + DQ)np+d-q+s×(P+D-Q)n.
2:     par(npar) – double array
npar, the dimension of the array, must satisfy the constraint npar = p + q + P + Qnpar=p+q+P+Q.
The pp values of the φϕ parameters, the qq values of the θθ parameters, the PP values of the ΦΦ parameters, and the QQ values of the ΘΘ parameters, in that order.
3:     c – double scalar
cc, the expected value of the differenced series (i.e., cc is the constant correction). Where there is no constant term, c must be set to 0.00.0.
4:     kfc – int64int32nag_int scalar
Must be set to 00 if c was not estimated, and 11 if c was estimated. This is irrespective of whether or not c = 0.0c=0.0. The only effect is that the residual degrees of freedom are one greater when kfc = 0kfc=0. Assuming the supplied time series to be the same as that to which the model was originally fitted, this ensures an unbiased estimate of the residual mean-square.
Constraint: kfc = 0kfc=0 or 11.
5:     x(nx) – double array
The nn values of the original undifferenced time series.
6:     ist – int64int32nag_int scalar
The dimension of the array st as declared in the (sub)program from which nag_tsa_uni_arima_forcecast (g13aj) is called.
Constraint: ist(P × s) + d + (D × s) + q + max (p,Q × s)ist(P×s)+d+(D×s)+q+max(p,Q×s). The expression on the right-hand side of the inequality is returned in nst.
7:     nfv – int64int32nag_int scalar
The required number of forecasts. If nfv0nfv0, no forecasts will be computed.
8:     ifv – int64int32nag_int scalar
The dimension of the arrays fva and fsd as declared in the (sub)program from which nag_tsa_uni_arima_forcecast (g13aj) is called.
Constraint: ifvmax (1,nfv)ifvmax(1,nfv).

Optional Input Parameters

1:     npar – int64int32nag_int scalar
Default: The dimension of the array par.
The exact number of φϕ, θθ, ΦΦ and ΘΘ parameters.
Constraint: npar = p + q + P + Qnpar=p+q+P+Q.
2:     nx – int64int32nag_int scalar
Default: The dimension of the array x.
nn, the length of the original undifferenced time series.

Input Parameters Omitted from the MATLAB Interface

w iw

Output Parameters

1:     rms – double scalar
The residual variance (mean square) associated with the model.
2:     st(ist) – double array
The nst values of the state set.
3:     nst – int64int32nag_int scalar
The number of values in the state set array st.
4:     fva(ifv) – double array
If nfv > 0nfv>0, fva contains the nfv forecast values relating to the original undifferenced time series.
5:     fsd(ifv) – double array
If nfv > 0nfv>0, fsd contains the estimated standard errors of the nfv forecast values.
6:     isf(44) – int64int32nag_int array
Contains validity indicators, one for each of the four possible parameter types in the model (autoregressive, moving average, seasonal autoregressive, seasonal moving average), in that order.
Each indicator has the interpretation:
1-1 On entry the set of parameter values of this type does not satisfy the stationarity or invertibility test conditions.
0-0 No parameter of this type is in the model.
1-1 Valid parameter values of this type have been supplied.
7:     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:
  ifail = 1ifail=1
On entry,nparp + q + P + Qnparp+q+P+Q,
orthe orders vector mr is invalid (check the constraints in Section [Parameters]),
orkfc0kfc0 or 11.
  ifail = 2ifail=2
On entry, nxdD × snpar + kfcnx-d-D×snpar+kfc, i.e., the number of terms in the differenced series is not greater than the number of parameters in the model. The model is over-parameterised.
  ifail = 3ifail=3
On entry, the workspace array w is too small.
  ifail = 4ifail=4
On entry, the state set array st is too small. It must be at least as large as the exit value of nst.
  ifail = 5ifail=5
This indicates a failure in nag_linsys_real_posdef_solve_1rhs (f04as) which is used to solve the equations giving estimates of the backforecasts.
  ifail = 6ifail=6
On entry, valid values were not supplied for all parameter types in the model. Inspect array isf for further information on the parameter type(s) in error.
  ifail = 7ifail=7
On entry,ifv < max (1,nfv)ifv<max(1,nfv).

Accuracy

The computations are believed to be stable.

Further Comments

The time taken by nag_tsa_uni_arima_forcecast (g13aj) is approximately proportional to nn and the square of the number of backforecasts derived.

Example

function nag_tsa_uni_arima_forcecast_example
mr = [int64(1);1;2;0;0;0;0];
par = [-0.0547;
     -0.5568;
     -0.6636];
c = 9.9807;
kfc = int64(1);
x = [-217;
     -177;
     -166;
     -136;
     -110;
     -95;
     -64;
     -37;
     -14;
     -25;
     -51;
     -62;
     -73;
     -88;
     -113;
     -120;
     -83;
     -33;
     -19;
     21;
     17;
     44;
     44;
     78;
     88;
     122;
     126;
     114;
     85;
     64];
ist = int64(4);
nfv = int64(5);
ifv = int64(5);
[rms, st, nst, fva, fsd, isf, ifail] = ...
    nag_tsa_uni_arima_forcecast(mr, par, c, kfc, x, ist, nfv, ifv)
 

rms =

  375.9146


st =

   64.0000
  -30.9807
  -20.4495
   -2.7212


nst =

                    4


fva =

   60.5899
   69.4973
   79.5367
   89.5142
   99.4951


fsd =

   19.3885
   34.9870
   54.2475
   67.8676
   79.1975


isf =

                    1
                    1
                    0
                    0


ifail =

                    0


function g13aj_example
mr = [int64(1);1;2;0;0;0;0];
par = [-0.0547;
     -0.5568;
     -0.6636];
c = 9.9807;
kfc = int64(1);
x = [-217;
     -177;
     -166;
     -136;
     -110;
     -95;
     -64;
     -37;
     -14;
     -25;
     -51;
     -62;
     -73;
     -88;
     -113;
     -120;
     -83;
     -33;
     -19;
     21;
     17;
     44;
     44;
     78;
     88;
     122;
     126;
     114;
     85;
     64];
ist = int64(4);
nfv = int64(5);
ifv = int64(5);
[rms, st, nst, fva, fsd, isf, ifail] = g13aj(mr, par, c, kfc, x, ist, nfv, ifv)
 

rms =

  375.9146


st =

   64.0000
  -30.9807
  -20.4495
   -2.7212


nst =

                    4


fva =

   60.5899
   69.4973
   79.5367
   89.5142
   99.4951


fsd =

   19.3885
   34.9870
   54.2475
   67.8676
   79.1975


isf =

                    1
                    1
                    0
                    0


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