The forecast function allows you to produce future predictions of a time series
from fitted models. If the response variable has been transformed in the
model formula, the transformation will be automatically back-transformed
(and bias adjusted if bias_adjust
is TRUE
). More details about
transformations in the fable framework can be found in
vignette("transformations", package = "fable")
.
# S3 method for mdl_df
forecast(
object,
new_data = NULL,
h = NULL,
point_forecast = list(.mean = mean),
...
)# S3 method for mdl_ts
forecast(
object,
new_data = NULL,
h = NULL,
bias_adjust = NULL,
simulate = FALSE,
bootstrap = FALSE,
times = 5000,
point_forecast = list(.mean = mean),
...
)
A fable containing the following columns:
.model
: The name of the model used to obtain the forecast. Taken from
the column names of models in the provided mable.
The forecast distribution. The name of this column will be the same as the
dependent variable in the model(s). If multiple dependent variables exist,
it will be named .distribution
.
Point forecasts computed from the distribution using the functions in the
point_forecast
argument.
All columns in new_data
, excluding those whose names conflict with the
above.
The time series model used to produce the forecasts
A tsibble
containing future information used to forecast.
The forecast horison (can be used instead of new_data
for regular
time series with no exogenous regressors).
The point forecast measure(s) which should be returned
in the resulting fable. Specified as a named list of functions which accept
a distribution and return a vector. To compute forecast medians, you can use
list(.median = median)
.
Additional arguments for forecast model methods.
Deprecated. Please use point_forecast
to specify the
desired point forecast method.
Should forecasts be based on simulated future paths instead of analytical results.
Should innovations from simulated forecasts be bootstrapped from the model's fitted residuals. This allows the forecast distribution to have a different underlying shape which could better represent the nature of your data.
The number of future paths for simulations if simulate = TRUE
.
The forecasts returned contain both point forecasts and their distribution.
A specific forecast interval can be extracted from the distribution using the
hilo()
function, and multiple intervals can be obtained using report()
.
These intervals are stored in a single column using the hilo
class, to
extract the numerical upper and lower bounds you can use unpack_hilo()
.