Forecast the target variable from a fitted mf_model() object.
Arguments
- object
A
"mf_model"object returned bymf_model().- xreg
Optional future regressors in a
tsbox::ts_boxable()format. When omitted, the forecast regressor set stored insideobjectis used. When supplied,xregmust contain the same non-target regressors used when fitting the bridge equation.- level
Prediction interval levels used when the model was estimated with
se = TRUE. When uncertainty is unavailable,forecast()still returns these,lower, anduppercomponents, filled withNA.- ...
Unused.
- x
A
"mf_model_forecast"object returned byforecast.mf_model().
Value
An object of class "mf_model_forecast" containing point forecasts,
predictive uncertainty summaries, the observed target history, the
target-period regressors used for forecasting, and optional full-system
bootstrap metadata.
x, invisibly.
Details
In recursive bridge forecasts, uncertainty typically increases with
horizon because later forecast steps depend on forecasted rather than
observed target lags and, when needed, completed indicator paths. Under the
package's residual-resampling and full-system bootstrap workflows, those
simulated disturbances accumulate across steps, so standard errors and
interval widths can widen as the forecast horizon extends. The
uncertainty-and-scenarios vignette includes one worked example that trims
forecast rows by an acceptable prediction-interval width.
Interoperability with the forecast package
"mf_model_forecast" deliberately does not inherit from the forecast
package's "forecast" class. Target frequencies supported by mf_model()
include daily, weekly and sub-daily series, which stats::ts() cannot
represent without silently approximating the calendar, so an object that
claimed "forecast" inheritance could not honour it for every model this
package fits. Instead, plot() and ggplot2::autoplot() methods are
provided directly for "mf_model_forecast", and as.forecast() converts to
a genuine "forecast" object whenever the target frequency is regular
enough to allow it, for use with functions such as
forecast::accuracy().
Examples
gdp_growth <- tsbox::ts_pc(gdp)
#> [value]: 'values'
#> [value]: 'values'
gdp_growth <- tsbox::ts_na_omit(gdp_growth)
#> [value]: 'values'
model <- mf_model(
target = gdp_growth,
indic = baro,
indic_predict = "auto.arima",
indic_aggregators = "mean",
h = 1
)
forecast(model)
#> Mixed-frequency forecast
#> -----------------------------------
#> Target series: gdp_growth
#> Forecast horizon: 1
#> Uncertainty: point forecast only
#> -----------------------------------
#> time mean
#> 1 2023-01-01 0.161
