loo.bmgarch {bmgarch}R Documentation

Leave-Future-Out Cross Validation (LFO-CV)

Description

lfocv returns the LFO-CV ELPD by either computing the exact ELDP or by approximating it via forward or backward approximation strategies based on Pareto smoothed importance sampling described in (Bürkner et al. 2020).

Usage

## S3 method for class 'bmgarch'
loo(x, ..., type = "lfo", L = NULL, M = 1, mode = "backward")

Arguments

x

Fitted bmgarch model. lfocv inherits all attributes from the bmgarch object

...

Not used

type

Takes lfo (default) or loo. LFO-CV is recommended for time-series but LOO-CV may be obtained to assess the structural part of the model.

L

Minimal length of times series before computing LFO

M

M step head predictions. Defines to what period the LFO-CV should be tuned to. Defaults to M=1.

mode

backward elpd_lfo approximation, or exact elpd-lfo; Takes 'backward', and 'exact'. 'exact' fits N-L models and may take a very long time to complete. forward works too but is not complete yet.

Value

Approximate LFO-CV value and log-likelihood values across (L+1):N timepoints

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.

Examples

## Not run: 
data(stocks)
# Fit a DCC model 
fit <- bmgarch(data = stocks[1:100, c("toyota",  "nissan" )],
               parameterization = "DCC", standardize_data = TRUE,
               iterations = 500)

# Compute expected log-predictive density (elpd) using the backward mode
# L is the upper boundary of the time-series before we engage in LFO-CV
lfob <- loo(fit, mode = 'backward',  L = 50 )
print(lfob)

## End(Not run)

[Package bmgarch version 2.0.0 Index]