loo.bmgarch: Leave-Future-Out Cross Validation (LFO-CV)

View source: R/lfocv.R

loo.bmgarchR 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 \insertCiteBuerkner2019bmgarch.

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

\insertAllCited

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)

bmgarch documentation built on Sept. 12, 2023, 1:13 a.m.