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. |
... |
Not used |
type |
Takes |
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. |
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)