forecast
Syntax
Description
forecasts the response at each horizon step in forecastY
= forecast(Mdl
,PastTbl
)Mdl.Horizon
beyond the
time step of the latest observation in the past data PastTbl
. Before
forecasting, the function uses the data PastTbl
to prepare lagged
predictors. Then, for each horizon step in the direct forecasting model
Mdl
, the function uses the corresponding model in
Mdl.Learners
to forecast the response.
This syntax is appropriate when Mdl
does not use leading exogenous
predictors. That is, Mdl.LeadingPredictors
is empty.
returns forecast responses using the past exogenous predictor data
forecastY
= forecast(Mdl
,PastX
,PastY
)PastX
and the past response data PastY
. This
syntax is appropriate when Mdl
uses nonleading exogenous predictors and
lagged response variables as predictors, but does not use leading exogenous predictors. That
is, Mdl.PredictorNames
and Mdl.ResponseLags
are
nonempty, and Mdl.LeadingPredictors
is empty.
specifies leading predictor data at time steps beyond the past data, in addition to any of
the input argument combinations in previous syntaxes. This syntax assumes that
forecastY
= forecast(___,LeadingData=leadingData
)Mdl
uses leading exogenous predictors, and that
max(Mdl.Horizon)
is greater than or equal to
min(Mdl.LeadingPredictorLags) + 1
. To identify the variables that
leadingData
must include, use
Mdl.PredictorNames(Mdl.LeadingPredictors)
.
Examples
Input Arguments
Output Arguments
Limitations
When you use the
forecast
object function, the past data must contain at leastMdl.MaxLag
observations. The software requires these observations for creating lagged and leading predictors.
Tips
When
Mdl.LeadingPredictors
is nonempty andmax(Mdl.Horizon)
is less thanmin(Mdl.LeadingPredictorLags) + 1
, you do not have to specifyleadingData
. In this case, consider whether to specify the leading exogenous predictors as nonleading exogenous predictors when training the direct forecasting model.
Version History
Introduced in R2023b