PDF version (NAG web site
, 64-bit version, 64-bit version)
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 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 (uncorrected for the constant ), for , |
(ii) |
the values required to reconstitute the original series from the differenced series , |
(iii) |
the intermediate series
, for
, and |
(iv) |
the residual series , for . |
If the number of original undifferenced observations was , then and .
To update the state set, given a number of new undifferenced observations , , the four series above are first reconstituted.
Differencing and residual calculation operations are then applied to the new observations and new values of and are derived.
The first values in these three series are then discarded and a new state set is obtained.
The residuals in the series corresponding to the 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:
– 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:
– int64int32nag_int array
-
The orders vector of the ARIMA model, in the usual notation.
Constraints:
- ;
- ;
- ;
- if , ;
- if , .
- 3:
– double array
-
The estimates of the values of the parameters, the values of the parameters, the values of the parameters and the values of the parameters in the model – in that order, using the usual notation.
- 4:
– double scalar
-
The constant to be subtracted from the differenced data.
- 5:
– double array
-
The new undifferenced observations which are to be used to update
st.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
st.
The number of values in the state set array
st.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
par.
The number of , , and parameters in the model.
Constraint:
.
- 3:
– int64int32nag_int scalar
-
Default:
the dimension of the array
anx.
, the number of new observations in
anx.
Output Parameters
- 1:
– double array
-
The updated values of the state set.
- 2:
– double array
-
The residuals corresponding to the new observations in
anx.
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | , |
or | the orders vector mr is invalid (check the constraints in Arguments). |
-
-
On entry, | . |
-
-
-
-
On entry, | . |
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
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 .
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
, with seasonal period
. The number of parameters estimated was two: a non-seasonal moving average parameter
with value
and a seasonal moving average parameter
with value
. 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.
Open in the MATLAB editor:
g13ag_example
function g13ag_example
fprintf('g13ag example results\n\n');
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];
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.1570;
6.3063; 6.3261; 6.1377; 6.0088; 5.8916; 6.0039];
nux = numel(anx);
[st, anexr, ifail] = g13ag( ...
st, mr, par, c, anx);
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)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015