PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_tsa_multi_inputmod_forecast_state (g13bh)
Purpose
nag_tsa_multi_inputmod_forecast_state (g13bh) produces forecasts of a time series (the output series) which depends on one or more other (input) series via a multi-input model which will usually have been fitted using
nag_tsa_multi_inputmod_estim (g13be). The future values of the input series must be supplied. The original observations are not required.
nag_tsa_multi_inputmod_forecast_state (g13bh) uses as input either the original state set obtained from
nag_tsa_multi_inputmod_estim (g13be), or the state set updated by a series of new observations from
nag_tsa_multi_inputmod_update (g13bg). Standard errors of the forecasts are produced. If future values of some of the input series have been obtained as forecasts using ARIMA models for those series, this may be allowed for in the calculation of the standard errors.
Syntax
[
xxyn,
mrx,
fva,
fsd,
ifail] = g13bh(
sttf,
mr,
mt,
para,
xxyn,
mrx,
parx,
rmsxy,
kzef, 'nsttf',
nsttf, 'nser',
nser, 'npara',
npara, 'nfv',
nfv)
[
xxyn,
mrx,
fva,
fsd,
ifail] = nag_tsa_multi_inputmod_forecast_state(
sttf,
mr,
mt,
para,
xxyn,
mrx,
parx,
rmsxy,
kzef, 'nsttf',
nsttf, 'nser',
nser, 'npara',
npara, 'nfv',
nfv)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 22: |
nfv was made optional |
Description
The forecasts of the output series are calculated, for , where is the latest time point of the observations used to produce the state set and is the maximum lead time of the forecasts.
First the new input series values
are used to form the input components
, for
, using the transfer function models:
(a) |
. |
The output noise component
is then forecast by setting
, for
, and using the ARIMA model equations:
(b) |
|
(c) |
|
(d) |
. |
This last step of ‘integration’ reverses the process of differencing. Finally the output forecasts are calculated as
The forecast error variance of
(i.e., at lead time
) is
, which is the sum of parts which arise from the various input series, and the output noise component. That part due to the output noise is
where
is the estimated residual variance of the output noise ARIMA model, and
are the ‘psi-weights’ of this model as defined in
Box and Jenkins (1976). They are calculated by applying the equations
(b),
(c) and
(d) above, for
, but with artificial values for the various series and with the constant
set to
. Thus all values of
,
,
and
are taken as zero, for
;
is taken to be
, for
and
, for
. The resulting values of
, for
, are precisely
as required.
Further contributions to
come only from those input series, for which future values are forecasts which have been obtained by applying input series ARIMA models. For such a series the contribution is
where
is the estimated residual variance of the input series ARIMA model. The coefficients
are calculated by applying the transfer function model equation
(a) above, for
, but again with artificial values of the series. Thus all values of
and
, for
, are taken to be zero, and
are taken to be the psi-weight sequence
for the
input
series ARIMA model. The resulting values of
, for
, are precisely
as required.
In adding such contributions to to make up the total forecast error variance , it is assumed that the various input series with which these contributions are associated are statistically independent of each other.
When using the function in practice an ARIMA model is required for all the input series. In the case of those inputs for which no such ARIMA model is available (or its effects are to be excluded), the corresponding orders and parameters and the estimated residual variance should be set to zero.
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:
– double array
-
- 2:
– int64int32nag_int array
-
The orders vector
of the ARIMA model for the output noise component.
, , and give respectively the number of autoregressive , moving average , seasonal autoregressive and seasonal moving average parameters.
, and refer respectively to the order of non-seasonal differencing, the order of seasonal differencing, and the seasonal period.
Constraints:
- , , , , , , ;
- ;
- ;
- if , ;
- if , .
- 3:
– int64int32nag_int array
-
The transfer function orders
,
and
of each of the input series. The data for input series
are held in column
. Row 1 holds the value
, row 2 holds the value
and row 3 holds the value
. For a simple input,
.
Row 4 holds the value , where for a simple input, for a transfer function input. When , any nonzero contents of rows 1, 2 and 3 of column are ignored. The choice of or is an option for use in model estimation and does not affect the operation of nag_tsa_multi_inputmod_forecast_state (g13bh).
Constraint:
, or , for .
- 4:
– double array
-
Estimates of the multi-input model parameters as returned by
nag_tsa_multi_inputmod_estim (g13be). These are in order, firstly the ARIMA model parameters:
values of
parameters,
values of
parameters,
values of
parameters and
values of
parameters. These are followed by the transfer function model parameter values
,
for the first of any input series and similar sets of values for any subsequent input series. The final component of
para is the constant
.
- 5:
– double array
-
ldxxyn, the first dimension of the array, must satisfy the constraint
.
The supplied
nfv values for each of the input series required to produce the
nfv output series forecasts. Column
contains the values for input series
. Column
nser need not be supplied.
- 6:
– int64int32nag_int array
-
The orders array for each of the input series ARIMA models. Thus, column contains values of , , , , , , for input series . In the case of those inputs for which no ARIMA model is available, the corresponding orders should be set to . (The model for any input series only affects the standard errors of the forecast values.)
- 7:
– double array
-
ldparx, the first dimension of the array, must satisfy the constraint
, where is the maximum number of parameters in any of the input series ARIMA models. If there are no input series, .
Values of the parameters (
,
,
and
) for each of the input series ARIMA models. Thus column
contains
values of
parameters,
values of
parameters,
values of
parameters and
values of
parameters – in that order.
Values in the columns relating to those input series for which no ARIMA model is available are ignored. (The model for any input series only affects the standard errors of the forecast values.)
- 8:
– double array
-
The estimated residual variances for each input series ARIMA model followed by that for the output noise ARIMA model. In the case of those inputs for which no ARIMA model is available, or when its effects are to be excluded in the calculation of forecast standard errors, the corresponding entry of
rmsxy should be set to
.
- 9:
– int64int32nag_int scalar
-
Must not be set to
, if the values of the input component series
and the values of the output noise component
are to overwrite the contents of
xxyn on exit, and must be set to
if
xxyn is to remain unchanged on exit, apart from the appearance of the forecast values in column
nser.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
sttf.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
mt,
rmsxy and the second dimension of the arrays
xxyn,
parx. (An error is raised if these dimensions are not equal.)
The total number of input and output series. There may be any number of input series (including none), but only one output series.
- 3:
– int64int32nag_int scalar
-
Default:
the dimension of the array
para.
The exact number of , , , , , and parameters. ( must be included, whether its value was previously estimated or was set fixed).
- 4:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
xxyn.
The number of forecast values required.
Output Parameters
- 1:
– double array
-
If
, then column
nser of
xxyn contains the output series forecast values (as does
fva), but
xxyn is otherwise unchanged.
If
, then the columns of
xxyn hold the corresponding values of the forecast components
for each of the input series and the values of the output noise component
in that order.
- 2:
– int64int32nag_int array
-
Unchanged, apart from column
nser which is used for workspace.
- 3:
– double array
-
The required forecast values for the output series.
- 4:
– double array
-
The standard errors for each of the forecast values.
- 5:
– 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, | nsttf is not consistent with the orders in arrays mr and mt. |
-
-
On entry, | npara is not consistent with the orders in arrays mr and mt. |
-
-
On entry, | ldxxyn is too small. |
-
-
On entry, | iwa is too small. |
-
-
On entry, | ldparx is too small. |
-
-
On entry, one of the , stored in , for , does not equal , or .
-
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_multi_inputmod_forecast_state (g13bh) is approximately proportional to .
Example
This example follows up that described in
nag_tsa_multi_inputmod_update (g13bg) and makes use of its data. These consist of output series orders and parameter values, input series transfer function orders and the updated state set.
Four new values of the input series are supplied, as are the orders and parameter values for the single input series ARIMA model (which has values of , values of , value of , single seasonal differencing and a seasonal period of ), and the estimated residual variances for the input series ARIMA model and the output noise ARIMA model.
Four forecast values and their standard errors are computed and printed; also the values of the components and the output noise component corresponding to the forecasts.
Open in the MATLAB editor:
g13bh_example
function g13bh_example
fprintf('g13bh example results\n\n');
mr = [int64(1);0;0;0;1;1;4];
mt = [int64(1),0;
0, 0;
1, 0;
3, 0];
sttf = [ 6.7160; 158.3022; -80.3352; -74.8937; -80.7694;
-70.3022; 0.8476; -2.0234; -5.8080; 10.2943];
para = [0.5158; 0.9994; 8.6343; 0.6726; -0.3172];
xxyn = [6.923, 0; 6.939, 0; 6.705, 0; 6.914, 0];
mrx = [int64(2),0;
0, 0;
2, 0;
0, 0;
1, 0;
1, 0;
4, 0];
parx = [1.6743, 0;
-0.9505, 0;
1.4605, 0;
-0.4862, 0;
0.8993, 0];
rmsxy = [0.172; 22.9256];
kzef = int64(1);
[xxyn, mrx, fva, fsd, ifail] = ...
g13bh( ...
sttf, mr, mt, para, xxyn, mrx, parx, rmsxy, kzef);
fprintf('The forecast values and their standard errors\n\n');
fprintf(' i fva fsd\n\n');
fprintf('%4d%10.4f%10.4f\n',[[1:numel(fva)]' fva fsd]');
fprintf('\n z(t) n(t)\n');
disp(xxyn);
g13bh example results
The forecast values and their standard errors
i fva fsd
1 88.2723 4.7881
2 99.9425 6.4690
3 100.6499 7.3175
4 95.0958 7.5534
z(t) n(t)
164.4620 -76.1897
170.3924 -70.4499
174.5193 -73.8694
175.2747 -80.1789
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015