Learn R Programming

bmgarch (version 2.0.0)

loo.bmgarch: 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 Buerkner2019bmgarch.

Usage

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

Value

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

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.

References

Examples

Run this code
if (FALSE) {
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)
}

Run the code above in your browser using DataLab