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)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

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 Description in nag_tsa_uni_arima_estim (g13ae) or nag_tsa_uni_arima_estim_easy (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 wt (uncorrected for the constant c), for N-P×s<tN,
(ii) the d values required to reconstitute the original series xt from the differenced series wt,
(iii) the intermediate series et, for N - maxp, Q × s < t N , and
(iv) the residual series at, for N-q<tN.
If the number of original undifferenced observations was n, then d=d+D×s and N=n-d.
To update the state set, given a number of new undifferenced observations xt, t=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 k new values of wt,et and at are derived.
The first k values in these three series are then discarded and a new state set is obtained.
The residuals in the at series corresponding to the k 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:     stnst – double array
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:     mr7 int64int32nag_int array
The orders vector p,d,q,P,D,Q,s of the ARIMA model, in the usual notation.
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.
3:     parnpar – double array
The estimates of the p values of the ϕ parameters, the q values of the θ parameters, the P values of the Φ parameters and the Q 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:     anxnuv – 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+maxp,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+Q.
3:     nuv int64int32nag_int scalar
Default: the dimension of the array anx.
k, the number of new observations in anx.

Output Parameters

1:     stnst – double array
The updated values of the state set.
2:     anexrnuv – double array
The residuals corresponding to the new observations in anx.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry,nparp+q+P+Q,
orthe orders vector mr is invalid (check the constraints in Arguments).
   ifail=2
On entry,nstP×s+D×s+d+q+maxQ×s,p.
   ifail=3
On entry,nuv0.
   ifail=4
On entry,nwa<4×npar+3×nst.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

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×npar.

Example

The following program is based on data derived from a study of monthly airline passenger totals (in thousands) to which a logarithmic transformation had been applied. The time series model was based on seasonal and non-seasonal differencing both of order 1, with seasonal period 12. The number of parameters estimated was two: a non-seasonal moving average parameter θ1 with value 0.327 and a seasonal moving average parameter Θ1 with value 0.6270. There was no constant correction. These, together with the state set array, were obtained using nag_tsa_uni_arima_estim (g13ae).
Twelve new observations are supplied. The function updates the state set and outputs a set of residuals corresponding to the new observations.
function g13ag_example


fprintf('g13ag example results\n\n');

% Previously calculated state set (g13ae, g13af or prior g13ag)
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.0290;   0.0147;   0.0373;
     -0.0931;   0.0223;  -0.0172;  -0.0353;  -0.0413];

% Orders
mr = [int64(0);1;1;0;1;1;12];
par = [0.327;    0.627];
c = 0;

% New update observations
anx = [5.8861;  5.8348;   6.0064;   5.9814;   6.0403;   6.1570;
       6.3063;  6.3261;   6.1377;   6.0088;   5.8916;   6.0039];
nux = numel(anx);

% Update state set
[st, anexr, ifail] = g13ag( ...
                            st, mr, par, c, anx);

%  Display results
nst = numel(st);
fprintf('The updated state set array now holds the values\n');
for j = 1:8:nst
  fprintf('%8.4f', st(j:min(j+7,nst)));
  fprintf('\n');
end
fprintf('\nThe residuals corresponding to the %4d values used to\n', nux);
fprintf('update the system are\n');
for j = 1:8:nux
  fprintf('%8.4f', anexr(j:min(j+7,nux)));
  fprintf('\n');
end


g13ag example results

The updated state set array now holds the values
  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

The residuals corresponding to the   12 values used to
update the system are
  0.0309  0.0031  0.0263  0.0105  0.0388 -0.0333  0.0265  0.0238
 -0.0159 -0.0020  0.0182  0.0126

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–2015