A common objective of time series modeling is generating forecasts for a process over a future time horizon. That is, given an observed series y1, y2,...,yN and a forecast horizon h, generate predictions for
Let denote a forecast for the process at time t + 1, conditional on the history of the process up to time t, Ht, and the exogenous covariate series up to time t + 1, Xt + 1, if a regression component is included in the model. The minimum mean square error (MMSE) forecast is the forecast that minimizes expected square loss,
Minimizing this loss function yields the MMSE forecast,
forecastGenerates MMSE Forecasts
forecast function generates MMSE forecasts recursively.
When you call
forecast, you specify the model
Mdl, forecast horizon
Y0. You can optionally specify the presample
'E0', conditional variances
and exogenous data
'X0' by using name-value pair arguments.
forecast does not require
forecast sample exogenous data
XF, if you specify
X0 then you must also specify
To begin forecasting from the end of an observed series, say
use the last few observations of
Y as presample responses
Y0 to initialize the forecast. There are several points to
keep in mind when you specify presample data:
The minimum number of responses needed to initialize forecasting is stored
in the property
P of an
If you provide too few presample observations,
returns an error.
If you forecast a model with an MA component, then
forecast requires presample innovations. The number
of innovations needed is stored in the property
Q of an
arima model. If you also have a conditional variance
model, you must additionally account for any presample innovations it
requires. If you specify presample innovations, but not enough,
forecast returns an error.
If you do not specify any presample innovations, but specify sufficient
presample responses (at least
Q) and exogenous covariate data (at least the number
of presample responses minus
forecast automatically infers presample innovations.
In general, the longer the presample response series you provide, the better
the inferred presample innovations will be. If you provide presample
responses and exogenous covariate data, but not enough,
forecast sets presample innovations equal to
If you forecast a model with a regression component, then
forecast requires future exogenous covariate data for
all time points in the forecast period (
you provide future exogenous covariate data, but not enough, then
forecast returns an error.
Consider generating forecasts for an AR(2) process,
Given presample observations and forecasts are recursively generated as follows:
For a stationary AR process, this recursion converges to the unconditional mean of the process,
For an MA(2) process, e.g.,
you need 2 presample innovations to initialize the forecasts. All innovations from time N + 1 and greater are set to their expectation, zero. Thus, for an MA(2) process, the forecast for any time more than 2 steps in the future is the unconditional mean, μ.
The forecast mean square error for an s-step ahead forecast is given by
Consider a conditional mean model given by
where . Sum the variances of the lagged innovations to get the s-step MSE,
where denotes the innovation variance.
For stationary processes, the coefficients of the infinite lag operator polynomial are absolutely summable, and the MSE converges to the unconditional variance of the process.
For nonstationary processes, the series does not converge, and the forecast error grows over time.