PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_tsa_uni_arima_forcecast (g13aj)
Purpose
nag_tsa_uni_arima_forcecast (g13aj) applies a fully specified seasonal ARIMA model to an observed time series, generates the state set for forecasting and (optionally) derives a specified number of forecasts together with their standard deviations.
Syntax
[
rms,
st,
nst,
fva,
fsd,
isf,
ifail] = g13aj(
mr,
par,
c,
kfc,
x,
ist,
nfv,
ifv, 'npar',
npar, 'nx',
nx)
[
rms,
st,
nst,
fva,
fsd,
isf,
ifail] = nag_tsa_uni_arima_forcecast(
mr,
par,
c,
kfc,
x,
ist,
nfv,
ifv, 'npar',
npar, 'nx',
nx)
Description
The time series supplied to the function is assumed to follow a seasonal autoregressive integrated moving average (ARIMA) model with known parameters.
The model is defined by the following relations.
(a) |
where is the result of applying non-seasonal differencing of order and seasonal differencing of seasonality and order to the series , and is a constant. |
(b) |
This equation describes the seasonal structure with seasonal period ; in the absence of seasonality it reduces to . |
(c) |
This equation describes the non-seasonal structure. |
Given the series, the constant
, and the model parameters
,
,
,
, the function computes the following.
(a) |
The state set required for forecasting. This contains the minimum amount of information required for forecasting and comprises:
(i) |
the differenced series , for ; |
(ii) |
the values required to reconstitute the original series from the differenced series ; |
(iii) |
the intermediate series , for ; |
(iv) |
the residual series , for , where . |
|
(b) |
A set of forecasts of and their estimated standard errors, , for ( may be zero).
The forecasts and estimated standard errors are generated from the state set, and are identical to those that would be produced from the same state set by nag_tsa_uni_arima_forecast_state (g13ah). |
Use of nag_tsa_uni_arima_forcecast (g13aj) should be confined to situations in which the state set for forecasting is unknown. Forecasting from the series requires recalculation of the state set and this is relatively expensive.
References
Box G E P and Jenkins G M (1976) Time Series Analysis: Forecasting and Control (Revised Edition) Holden–Day
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int array
-
The orders vector of the ARIMA model, in the usual notation.
Constraints:
- ;
- ;
- ;
- if , ;
- if , ;
- ;
- .
- 2:
– double array
-
The values of the parameters, the values of the parameters, the values of the parameters, and the values of the parameters, in that order.
- 3:
– double scalar
-
, the expected value of the differenced series (i.e.,
is the constant correction). Where there is no constant term,
c must be set to
.
- 4:
– int64int32nag_int scalar
-
Must be set to
if
c was not estimated, and
if
c was estimated. This is irrespective of whether or not
. The only effect is that the residual degrees of freedom are one greater when
. Assuming the supplied time series to be the same as that to which the model was originally fitted, this ensures an unbiased estimate of the residual mean-square.
Constraint:
or .
- 5:
– double array
-
The values of the original undifferenced time series.
- 6:
– int64int32nag_int scalar
-
The dimension of the array
st.
Constraint:
. The expression on the right-hand side of the inequality is returned in
nst.
- 7:
– int64int32nag_int scalar
-
The required number of forecasts. If , no forecasts will be computed.
- 8:
– int64int32nag_int scalar
-
The dimension of the arrays
fva and
fsd.
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
par.
The exact number of , , and parameters.
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
x.
, the length of the original undifferenced time series.
Output Parameters
- 1:
– double scalar
-
The residual variance (mean square) associated with the model.
- 2:
– double array
-
The
nst values of the state set.
- 3:
– int64int32nag_int scalar
-
The number of values in the state set array
st.
- 4:
– double array
-
If
,
fva contains the
nfv forecast values relating to the original undifferenced time series.
- 5:
– double array
-
If
,
fsd contains the estimated standard errors of the
nfv forecast values.
- 6:
– int64int32nag_int array
-
Contains validity indicators, one for each of the four possible parameter types in the model (autoregressive, moving average, seasonal autoregressive, seasonal moving average), in that order.
Each indicator has the interpretation:
|
On entry the set of parameter values of this type does not satisfy the stationarity or invertibility test conditions. |
|
No parameter of this type is in the model. |
|
Valid parameter values of this type have been supplied. |
- 7:
– 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), |
or | or . |
-
-
On entry, , i.e., the number of terms in the differenced series is not greater than the number of parameters in the model. The model is over-parameterised.
-
-
On entry, the workspace array w is too small.
-
-
On entry, the state set array
st is too small. It must be at least as large as the exit value of
nst.
-
-
This indicates a failure in
nag_linsys_real_posdef_solve_1rhs (f04as) which is used to solve the equations giving estimates of the backforecasts.
-
-
On entry, valid values were not supplied for all parameter types in the model. Inspect array
isf for further information on the parameter type(s) in error.
-
-
-
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_forcecast (g13aj) is approximately proportional to and the square of the number of backforecasts derived.
Example
The data is that used in the example program for
nag_tsa_uni_arima_estim_easy (g13af). Five forecast values and their standard errors, together with the state set, are computed and printed.
Open in the MATLAB editor:
g13aj_example
function g13aj_example
fprintf('g13aj example results\n\n');
mr = [int64(1); 1; 2; 0; 0; 0; 0];
par = [-0.0547; -0.5568; -0.6636];
x = [-217; -177; -166; -136; -110; -95; -64; -37; -14; -25;
-51; -62; -73; -88; -113; -120; -83; -33; -19; 21;
17; 44; 44; 78; 88; 122; 126; 114; 85; 64];
ist = int64(4);
kfc = int64(1);
nfv = int64(5);
ifv = int64(nfv);
c = 9.9807;
[rms, st, nst, fva, fsd, isf, ifail] = ...
g13aj( ...
mr, par, c, kfc, x, ist, nfv, ifv);
fprintf('The residual mean square is %9.2f\n\n', rms);
fprintf('The state set consists of %4d values\n', nst);
for j = 1:6:nst
fprintf('%11.4f', st(j:min(j+5,nst)));
fprintf('\n');
end
fprintf('\nThe %4d forecast values and standard errors are -\n', nfv);
fprintf('%10.2f%10.2f\n', [fva fsd]');
g13aj example results
The residual mean square is 375.91
The state set consists of 4 values
64.0000 -30.9807 -20.4495 -2.7212
The 5 forecast values and standard errors are -
60.59 19.39
69.50 34.99
79.54 54.25
89.51 67.87
99.50 79.20
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015