model_weights {bmgarch}R Documentation

Model weights

Description

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 Bürkner et al. (2020) 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.

Usage

model_weights(
  bmgarch_objects = NULL,
  L = NULL,
  M = 1,
  method = "stacking",
  mode = "backward"
)

Arguments

bmgarch_objects

list of bmgarch model objects in bmgarch_object

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'

Details

‘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 (Yao et al. 2018).

Value

Model weights

References

Bürkner P, Gabry J, Vehtari A (2020). “Approximate leave-future-out cross-validation for Bayesian time series models.” Journal of Statistical Computation and Simulation, 1–25. doi:10.1080/00949655.2020.1783262.

Yao Y, Vehtari A, Simpson D, Gelman A (2018). “Using Stacking to Average Bayesian Predictive Distributions.” Bayesian Analysis, 13(3), 917–1007. doi:10.1214/17-BA1091.

Examples

## 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)

[Package bmgarch version 2.0.0 Index]