Visualize a "mf_model_forecast" object returned by forecast.mf_model(),
showing the observed target history together with the bridge forecast and,
when available, a prediction interval.
Arguments
- x
A
"mf_model_forecast"object returned byforecast.mf_model().- level
Prediction interval level to display. Must be one of the levels the forecast was computed with. Defaults to the first available level.
- history_n
Number of historical target observations to display. Defaults to the most recent
50. Set toNULLto show the full history.- xlab, ylab, main
Optional axis and title labels.
- ...
Additional arguments passed to
theme_bridgr().- object
A
"mf_model_forecast"object, for theggplot2::autoplot()method.
Details
These methods are provided directly for "mf_model_forecast"
rather than inherited from the forecast package, so that plotting
works for every target frequency mf_model() supports, including daily
and weekly targets that stats::ts() cannot represent. See
as.forecast() to convert to a "forecast" object where the frequency
allows it.
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
)
plot(forecast(model))
