Skip to contents

Forecast the target variable from a fitted mf_model() object.

Usage

# S3 method for class 'mf_model'
forecast(object, xreg = NULL, level = c(80, 95), ...)

# S3 method for class 'mf_model_forecast'
print(x, ...)

Arguments

object

A "mf_model" object returned by mf_model().

xreg

Optional future regressors in a tsbox::ts_boxable() format. When omitted, the forecast regressor set stored inside object is used. When supplied, xreg must 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 the se, lower, and upper components, filled with NA.

...

Unused.

x

A "mf_model_forecast" object returned by forecast.mf_model().

Value

An object of class "mf_model_forecast" and "forecast" containing point forecasts, predictive uncertainty summaries, 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.

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