ensemble.mvgam_forecast {mvgam} | R Documentation |
Combine mvgam forecasts into evenly weighted ensembles
Description
Generate evenly weighted ensemble forecast distributions from mvgam_forecast
objects
Usage
ensemble(object, ...)
## S3 method for class 'mvgam_forecast'
ensemble(object, ..., ndraws = 5000)
Arguments
object |
|
... |
More |
ndraws |
Positive integer specifying the number of draws to use from each
forecast distribution for creating the ensemble. If some of the ensemble members have
fewer draws than |
Details
It is widely recognised in the forecasting literature that combining forecasts
from different models often results in improved forecast accuracy. The simplest way to create
an ensemble is to use evenly weighted combinations of forecasts from the different models.
This is straightforward to do in a Bayesian setting with mvgam
as the posterior MCMC draws
contained in each mvgam_forecast
object will already implicitly capture correlations among
the temporal posterior predictions.
Value
An object of class mvgam_forecast
containing the ensemble predictions. This
object can be readily used with the supplied S3 functions plot
and score
Author(s)
Nicholas J Clark
See Also
plot.mvgam_forecast
, score.mvgam_forecast
Examples
# Simulate some series and fit a few competing dynamic models
set.seed(1)
simdat <- sim_mvgam(n_series = 1,
prop_trend = 0.6,
mu = 1)
plot_mvgam_series(data = simdat$data_train,
newdata = simdat$data_test)
m1 <- mvgam(y ~ 1,
trend_formula = ~ time +
s(season, bs = 'cc', k = 9),
trend_model = AR(p = 1),
noncentred = TRUE,
data = simdat$data_train,
newdata = simdat$data_test)
m2 <- mvgam(y ~ time,
trend_model = RW(),
noncentred = TRUE,
data = simdat$data_train,
newdata = simdat$data_test)
# Calculate forecast distributions for each model
fc1 <- forecast(m1)
fc2 <- forecast(m2)
# Generate the ensemble forecast
ensemble_fc <- ensemble(fc1, fc2)
# Plot forecasts
plot(fc1)
plot(fc2)
plot(ensemble_fc)
# Score forecasts
score(fc1)
score(fc2)
score(ensemble_fc)