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_forecast_state (g13ah)

Purpose

nag_tsa_uni_arima_forecast_state (g13ah) produces forecasts of a time series, given a time series model which has already been fitted to the time series using nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af). The original observations are not required, since nag_tsa_uni_arima_forecast_state (g13ah) uses as input either the original state set produced by nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af) or the state set updated by a series of new observations using nag_tsa_uni_arima_update (g13ag). Standard errors of the forecasts are also provided.

Syntax

[fva, fsd, ifail] = g13ah(st, mr, par, c, rms, nfv, 'nst', nst, 'npar', npar)
[fva, fsd, ifail] = nag_tsa_uni_arima_forecast_state(st, mr, par, c, rms, nfv, 'nst', nst, 'npar', npar)

Description

The original time series is xtxt, for t = 1,2,,nt=1,2,,n and parameters have been fitted to the model of this time series using nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af).
Forecasts of xtxt, for t = n + 1,,n + Lt=n+1,,n+L, are calculated in five stages, as follows:
(i) set at = 0at=0 for t = N + 1,N + 2,,N + Lt=N+1,N+2,,N+L, where N = nd(D × s)N=n-d-(D×s) is the number of differenced values in the series;
(ii) calculate the values of etet, for t = N + 1,,N + Lt=N+1,,N+L, and et = φ1 × et1 + + φp × etp + atθ1 × at1θq × atqet=ϕ1×et-1++ ϕp×et-p+at-θ1×at-1--θq×at-q;
(iii) calculate the values of wtwt, for t = N + 1,,N + Lt=N+1,,N+L, where wt = Φ1 × wts + + ΦP × wts × P + etΘ1 × etsΘQ × ets × Qwt=Φ1×wt-s++ ΦP×wt-s×P+et-Θ1×et-s--ΘQ×et-s×Q and wtwt for tNtN are the first s × Ps×P values in the state set, corrected for the constant;
(iv) add the constant term cc to give the differenced series dsDxt = wt + cdsDxt=wt+c, for t = N + 1,,N + Lt=N+1,,N+L;
(v) the differencing operations are reversed to reconstitute xtxt, for t = n + 1,,n + Lt=n+1,,n+L.
The standard errors of these forecasts are given by st = [ V × (ψ02 + ψ12 + + ψtn12) ]1 / 2 st = [ V× ( ψ02 + ψ12 ++ ψt-n-12 ) ] 1/2 , for t = n + 1,,n + Lt=n+1,,n+L, where ψ0 = 1ψ0=1, VV is the residual variance of atat, and ψjψj is the coefficient expressing the dependence of xtxt on atjat-j.
To calculate ψjψj, for j = 1,2,,(L1)j=1,2,,(L-1), the following device is used.
A copy of the state set is initialized to zero throughout and the calculations outlined above for the construction of forecasts are carried out with the settings aN + 1 = 1aN+1=1, and at = 0at=0, for t = N + 2,,N + Lt=N+2,,N+L.
The resulting quantities corresponding to the sequence xN + 1,xN + 2,,xN + LxN+1,xN+2,,xN+L are precisely 11, ψ1,ψ2,,ψL1ψ1,ψ2,,ψL-1.
The supplied time series model is used throughout these calculations, with the exception that the constant term cc is taken to be zero.

References

None.

Parameters

Compulsory Input Parameters

1:     st(nst) – double array
nst, the dimension of the array, must satisfy the constraint nst = P × s + D × s + d + q + max (p,Q × s)nst=P×s+D×s+d+q+max(p,Q×s). (As returned by nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af)).
The state set derived from nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af) originally, or as modified using earlier calls of nag_tsa_uni_arima_update (g13ag).
2:     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.
3:     par(npar) – double array
npar, the dimension of the array, must satisfy the constraint npar = p + q + P + Qnpar=p+q+P+Q.
The estimates of 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 which specify the model and which were output originally by nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af).
4:     c – double scalar
cc, the value of the model constant. This will have been output by nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af).
5:     rms – double scalar
VV, the residual variance associated with the model.
If nag_tsa_uni_arima_estim_easy (g13af) was used to estimate the model, rms should be set to s / ndfs/ndf, where s and ndf were output by nag_tsa_uni_arima_estim_easy (g13af).
If nag_tsa_uni_arima_estim (g13ae) was used to estimate the model, rms should be set to s / icount(5)s/icount5, where s and icount(5)icount5 were output by nag_tsa_uni_arima_estim (g13ae).
Constraint: rms0.0rms0.0.
6:     nfv – int64int32nag_int scalar
LL, the required number of forecasts.
Constraint: nfv > 0nfv>0.

Optional Input Parameters

1:     nst – int64int32nag_int scalar
Default: The dimension of the array st.
The number of values in the state set array st.
Constraint: nst = P × s + D × s + d + q + max (p,Q × s)nst=P×s+D×s+d+q+max(p,Q×s). (As returned by nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af)).
2:     npar – int64int32nag_int scalar
Default: The dimension of the array par.
The number of φϕ, θθ, ΦΦ and ΘΘ parameters in the model.
Constraint: npar = p + q + P + Qnpar=p+q+P+Q.

Input Parameters Omitted from the MATLAB Interface

wa nwa

Output Parameters

1:     fva(nfv) – double array
nfv forecast values relating to the original undifferenced series.
2:     fsd(nfv) – double array
The standard errors associated with each of the nfv forecast values in fva.
3:     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 given in Section [Parameters]).
  ifail = 2ifail=2
On entry,nstP × s + D × s + d + q + max (Q × s,p)nstP×s+D×s+d+q+max(Q×s,p).
  ifail = 3ifail=3
On entry,nfv0nfv0.
  ifail = 4ifail=4
On entry,nwa < 4 × npar + 3 × nstnwa<4×npar+3×nst.
  ifail = 5ifail=5
On entry,rms < 0.0rms<0.0.

Accuracy

The computations are believed to be stable.

Further Comments

The time taken by nag_tsa_uni_arima_forecast_state (g13ah) is approximately proportional to nfv × nparnfv×npar.

Example

function nag_tsa_uni_arima_forecast_state_example
st = [0.066;
     -0.0513;
     0.1715;
     -0.0249;
     0.0588;
     0.1167;
     0.1493;
     0.0199;
     -0.1884;
     -0.1289;
     -0.1172;
     0.1122;
     6.0039;
     0.0443;
     -0.007;
     0.0252;
     0.002;
     0.0353;
     -0.046;
     0.0374;
     0.0151;
     -0.0237;
     0.0031;
     0.0188;
     0.0066;
     0.0125];
mr = [int64(0);1;1;0;1;1;12];
par = [0.327;
     0.6262];
c = 0;
rms = 0.0014;
nfv = int64(12);
[fva, fsd, ifail] = nag_tsa_uni_arima_forecast_state(st, mr, par, c, rms, nfv)
 

fva =

    6.0381
    5.9912
    6.1469
    6.1207
    6.1574
    6.3029
    6.4288
    6.4392
    6.2657
    6.1348
    6.0059
    6.1139


fsd =

    0.0374
    0.0451
    0.0517
    0.0575
    0.0627
    0.0676
    0.0721
    0.0764
    0.0805
    0.0843
    0.0880
    0.0915


ifail =

                    0


function g13ah_example
st = [0.066;
     -0.0513;
     0.1715;
     -0.0249;
     0.0588;
     0.1167;
     0.1493;
     0.0199;
     -0.1884;
     -0.1289;
     -0.1172;
     0.1122;
     6.0039;
     0.0443;
     -0.007;
     0.0252;
     0.002;
     0.0353;
     -0.046;
     0.0374;
     0.0151;
     -0.0237;
     0.0031;
     0.0188;
     0.0066;
     0.0125];
mr = [int64(0);1;1;0;1;1;12];
par = [0.327;
     0.6262];
c = 0;
rms = 0.0014;
nfv = int64(12);
[fva, fsd, ifail] = g13ah(st, mr, par, c, rms, nfv)
 

fva =

    6.0381
    5.9912
    6.1469
    6.1207
    6.1574
    6.3029
    6.4288
    6.4392
    6.2657
    6.1348
    6.0059
    6.1139


fsd =

    0.0374
    0.0451
    0.0517
    0.0575
    0.0627
    0.0676
    0.0721
    0.0764
    0.0805
    0.0843
    0.0880
    0.0915


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