PDF version (NAG web site
, 64-bit version, 64-bit version)
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
, for
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
, for
, are calculated in five stages, as follows:
(i) |
set for , where is the number of differenced values in the series; |
(ii) |
calculate the values of , for , and ; |
(iii) |
calculate the values of , for , where and for are the first values in the state set, corrected for the constant; |
(iv) |
add the constant term to give the differenced series , for ; |
(v) |
the differencing operations are reversed to reconstitute , for . |
The standard errors of these forecasts are given by , for , where , is the residual variance of , and is the coefficient expressing the dependence of on .
To calculate , for , 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 , and , for .
The resulting quantities corresponding to the sequence are precisely , .
The supplied time series model is used throughout these calculations, with the exception that the constant term is taken to be zero.
References
None.
Parameters
Compulsory Input Parameters
- 1:
– double array
-
- 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 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:
– double scalar
-
, 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:
– double scalar
-
, 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
, 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
, where
s and
were output by
nag_tsa_uni_arima_estim (g13ae).
Constraint:
.
- 6:
– int64int32nag_int scalar
-
, the required number of forecasts.
Constraint:
.
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:
.
Output Parameters
- 1:
– double array
-
nfv forecast values relating to the original undifferenced series.
- 2:
– double array
-
The standard errors associated with each of the
nfv forecast values in
fva.
- 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 given 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_forecast_state (g13ah) is approximately proportional to .
Example
The following program is based on the data derived in the example used to illustrate
nag_tsa_uni_arima_update (g13ag).
These consist of a set of orders indicating that there are two moving average parameters (one non-seasonal, and one seasonal with periodicity ).
The model constant is zero.
The state set contains values.
In addition the residual mean-square derived when the model was originally fitted is given.
Twelve forecasts and their associated errors are obtained.
Open in the MATLAB editor:
g13ah_example
function g13ah_example
fprintf('g13ah example results\n\n');
st = [0.0660; -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.0070;
0.0252; 0.0020; 0.0353; -0.0460; 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];
rms = 0.0014;
c = 0;
nfv = int64(12);
[fva, fsd, ifail] = g13ah( ...
st, mr, par, c, rms, nfv);
fprintf('The required %4d forecast values are as follows\n', nfv);
for j = 1:8:nfv
fprintf('%8.4f', fva(j:min(j+7,nfv)));
fprintf('\n');
end
fprintf('\nThe standard deviations corresponding to the forecasts are\n');
for j = 1:8:nfv
fprintf('%8.4f', fsd(j:min(j+7,nfv)));
fprintf('\n');
end
g13ah example results
The required 12 forecast values are as follows
6.0381 5.9912 6.1469 6.1207 6.1574 6.3029 6.4288 6.4392
6.2657 6.1348 6.0059 6.1139
The standard deviations corresponding to the forecasts are
0.0374 0.0451 0.0517 0.0575 0.0627 0.0676 0.0721 0.0764
0.0805 0.0843 0.0880 0.0915
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015