# naginterfaces.library.tsa.multi_​inputmod_​forecast_​state¶

naginterfaces.library.tsa.multi_inputmod_forecast_state(sttf, mr, mt, para, xxyn, mrx, parx, rmsxy, kzef)[source]

multi_inputmod_forecast_state 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 multi_inputmod_estim(). The future values of the input series must be supplied. The original observations are not required. multi_inputmod_forecast_state uses as input either the original state set obtained from multi_inputmod_estim(), or the state set updated by a series of new observations from multi_inputmod_update(). 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.

For full information please refer to the NAG Library document for g13bh

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g13/g13bhf.html

Parameters
sttffloat, array-like, shape

The values in the state set as returned by multi_inputmod_estim() or multi_inputmod_update().

mrint, array-like, shape

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.

mtint, array-like, shape

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, or 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 multi_inputmod_forecast_state.

parafloat, array-like, shape

Estimates of the multi-input model parameters as returned by multi_inputmod_estim(). 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 is the constant .

xxynfloat, array-like, shape

The supplied values for each of the input series required to produce the output series forecasts. Column contains the values for input series . Column need not be supplied.

mrxint, array-like, shape

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.)

parxfloat, array-like, shape

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.)

rmsxyfloat, array-like, shape

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 should be set to .

kzefint

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 on exit, and must be set to if is to remain unchanged on exit, apart from the appearance of the forecast values in column .

Returns
xxynfloat, ndarray, shape

If , then column of contains the output series forecast values (as does ), but is otherwise unchanged.

If , then the columns of 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.

mrxint, ndarray, shape

Unchanged, apart from column which is used for workspace.

fvafloat, ndarray, shape

The required forecast values for the output series.

fsdfloat, ndarray, shape

The standard errors for each of the forecast values.

Raises
NagValueError
(errno )

On entry, and the expected .

Constraint: , and must be consistent.

(errno )

On entry, and the expected .

Constraint: , and must be consistent.

(errno )

The orders vector is invalid.

(errno )

On entry, and .

Constraint: , or .

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

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:

 zt=δ1zt−1+δ2zt−2+⋯+δpzt−p+ω0xt−b−ω1xt−b−1−⋯−ωqxt−b−q.

The output noise component is then forecast by setting , for , and using the ARIMA model equations:

 et=ϕ1et−1+ϕ2et−2+⋯+ϕpet−p+at−θ1at−1−θ2at−2−⋯−θ1at−q wt=Φ1wt−s+Φ2wt−2×s+⋯+ΦPwt−P×s+et−Θ1et−s−Θ2et−2×s−⋯−ΘQet−Q×s nt=(∇d∇Ds)−1(wt+c).

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