View source: R/model_weights.R
model_weights | R Documentation |
Compute model weights for a list of candidate models based on leave-future-out
cross validation (lfocv) expected log-predictive density (elpd).
elpd can be approximated via the 'backward' mode described in \insertCiteBuerkner2019;textualbmgarch or via exact cross-validation.
The obtained weights can be passed to the forecast function to obtain weighted forecasts.
bmgarch_objects
takes a bmgarch_object
lists.
model_weights(
bmgarch_objects = NULL,
L = NULL,
M = 1,
method = "stacking",
mode = "backward"
)
bmgarch_objects |
list of bmgarch model objects in |
L |
Minimal length of time series before engaging in lfocv |
M |
M step head predictions. Defines to what period the LFO-CV should be tuned to. Defaults to M=1. |
method |
Ensemble methods, 'stacking' (default) or 'pseudobma' |
mode |
Either 'backward' (default) or 'exact' |
‘model_weights()' is a wrapper around the leave-future-out ’lfo' type in 'loo.bmgarch()'. The weights can be either obtained from an approximate or exact leave-future-out cross-validation to compute expected log predictive density (ELPD).
We can either obtain stacking weights or pseudo-BMA+ weigths as described in \insertCiteYao2018bmgarch.
Model weights
## Not run:
data(stocks)
# Fit at least two models on a subset of the stocks data
# to compute model weights
fit <- bmgarch(data = stocks[1:100, c("toyota", "nissan" )],
parameterization = "DCC", standardize_data = TRUE,
iterations = 500)
fit2 <- bmgarch(data = stocks[1:100, c("toyota", "nissan" )],
P = 2, Q = 2,
parameterization = "DCC", standardize_data = TRUE,
iterations = 500)
# create a bmgarch_list object
blist <- bmgarch_list(fit, fit2 )
# Compute model weights with the default stacking metod
# L is the upper boundary of the time-series before we engage in LFO-CV
mw <- model_weights( blist, L = 50, method = 'stacking', order = 'backwards' )
# Print model weights in the ordert of the bmgarch_list()
print(mw)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.