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_update (g13ag)

Purpose

nag_tsa_uni_arima_update (g13ag) accepts a series of new observations of a time series, the model of which is already fully specified, and updates the ‘state set’ information for use in constructing further forecasts. The previous specifications of the time series model should have been obtained by using nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af) to estimate the relevant parameters. The supplied state set will originally have been produced by nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (g13af), but may since have been updated by earlier calls to nag_tsa_uni_arima_update (g13ag).
A set of residuals corresponding to the new observations is returned. These may be of use in checking that the new observations conform to the previously fitted model.

Syntax

[st, anexr, ifail] = g13ag(st, mr, par, c, anx, 'nst', nst, 'npar', npar, 'nuv', nuv)
[st, anexr, ifail] = nag_tsa_uni_arima_update(st, mr, par, c, anx, 'nst', nst, 'npar', npar, 'nuv', nuv)

Description

The time series model is specified as outlined in Section [Description] in (g13ae) or (g13af). This also describes how the state set, which contains the minimum amount of time series information needed to construct forecasts, is made up of
(i) the differenced series wtwt (uncorrected for the constant cc), for (NP × s) < tN(N-P×s)<tN,
(ii) the dd values required to reconstitute the original series xtxt from the differenced series wtwt,
(iii) the intermediate series etet, for (Nmax (p, Q × s )) < t N ( N - max(p, Q × s ) ) < t N , and
(iv) the residual series atat, for (Nq) < tN(N-q)<tN.
If the number of original undifferenced observations was nn, then d = d + (D × s)d=d+(D×s) and N = ndN=n-d.
To update the state set, given a number of new undifferenced observations xtxt, t = n + 1,n + 2,,n + kt=n+1,n+2,,n+k, the four series above are first reconstituted.
Differencing and residual calculation operations are then applied to the new observations and kk new values of wt,etwt,et and atat are derived.
The first kk values in these three series are then discarded and a new state set is obtained.
The residuals in the atat series corresponding to the kk new observations are preserved in an output array. The parameters of the time series model are not changed in this function.

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), 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 in the model – in that order, using the usual notation.
4:     c – double scalar
The constant to be subtracted from the differenced data.
5:     anx(nuv) – double array
The new undifferenced observations which are to be used to update st.

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.
3:     nuv – int64int32nag_int scalar
Default: The dimension of the array anx.
kk, the number of new observations in anx.

Input Parameters Omitted from the MATLAB Interface

wa nwa

Output Parameters

1:     st(nst) – double array
The updated values of the state set.
2:     anexr(nuv) – double array
The residuals corresponding to the new observations in anx.
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 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,nuv0nuv0.
  ifail = 4ifail=4
On entry,nwa < 4 × npar + 3 × nstnwa<4×npar+3×nst.

Accuracy

The computations are believed to be stable.

Further Comments

The time taken by nag_tsa_uni_arima_update (g13ag) is approximately proportional to nuv × nparnuv×npar.

Example

function nag_tsa_uni_arima_update_example
st = [0.0118;
     -0.0669;
     0.1296;
     -0.0394;
     0.0422;
     0.1809;
     0.1211;
     0.0281;
     -0.2231;
     -0.1181;
     -0.1468;
     0.0835;
     5.8201;
     -0.0157;
     -0.0361;
     -0.0266;
     -0.0199;
     0.0298;
     0.029;
     0.0147;
     0.0373;
     -0.0931;
     0.0223;
     -0.0172;
     -0.0353;
     -0.0413];
mr = [int64(0);1;1;0;1;1;12];
par = [0.327;
     0.627];
c = 0;
anx = [5.8861;
     5.8348;
     6.0064;
     5.9814;
     6.0403;
     6.157;
     6.3063;
     6.3261;
     6.1377;
     6.0088;
     5.8916;
     6.0039];
[stOut, anexr, ifail] = nag_tsa_uni_arima_update(st, mr, par, c, anx)
 

stOut =

    0.0660
   -0.0513
    0.1716
   -0.0250
    0.0589
    0.1167
    0.1493
    0.0198
   -0.1884
   -0.1289
   -0.1172
    0.1123
    6.0039
    0.0444
   -0.0070
    0.0253
    0.0019
    0.0354
   -0.0460
    0.0374
    0.0151
   -0.0237
    0.0032
    0.0188
    0.0067
    0.0126


anexr =

    0.0309
    0.0031
    0.0263
    0.0105
    0.0388
   -0.0333
    0.0265
    0.0238
   -0.0159
   -0.0020
    0.0182
    0.0126


ifail =

                    0


function g13ag_example
st = [0.0118;
     -0.0669;
     0.1296;
     -0.0394;
     0.0422;
     0.1809;
     0.1211;
     0.0281;
     -0.2231;
     -0.1181;
     -0.1468;
     0.0835;
     5.8201;
     -0.0157;
     -0.0361;
     -0.0266;
     -0.0199;
     0.0298;
     0.029;
     0.0147;
     0.0373;
     -0.0931;
     0.0223;
     -0.0172;
     -0.0353;
     -0.0413];
mr = [int64(0);1;1;0;1;1;12];
par = [0.327;
     0.627];
c = 0;
anx = [5.8861;
     5.8348;
     6.0064;
     5.9814;
     6.0403;
     6.157;
     6.3063;
     6.3261;
     6.1377;
     6.0088;
     5.8916;
     6.0039];
[stOut, anexr, ifail] = g13ag(st, mr, par, c, anx)
 

stOut =

    0.0660
   -0.0513
    0.1716
   -0.0250
    0.0589
    0.1167
    0.1493
    0.0198
   -0.1884
   -0.1289
   -0.1172
    0.1123
    6.0039
    0.0444
   -0.0070
    0.0253
    0.0019
    0.0354
   -0.0460
    0.0374
    0.0151
   -0.0237
    0.0032
    0.0188
    0.0067
    0.0126


anexr =

    0.0309
    0.0031
    0.0263
    0.0105
    0.0388
   -0.0333
    0.0265
    0.0238
   -0.0159
   -0.0020
    0.0182
    0.0126


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