LPDS {shrinkTVPVAR}R Documentation

Calculate the log predictive density score (LPDS) for a fitted TVP-VAR-SV model

Description

LPDS calcualtes the one-step ahead log predictive density score (LPDS) for a fitted TVP-VAR-SV model resulting from a call to shrinkTVPVAR or shrinkDTVPVAR. The LPDS is calculated by sampling from the posterior predictive distribution of the model and evaluating the log predictive density at the true value of the next time-point.

Usage

LPDS(mod, y_true)

Arguments

mod

an object of class shrinkTVPVAR or shrinkDTVPVAR, containing the fitted model.

y_true

a numeric vector of length m containing the true value of the next time-point, i.e. the value at time N + 1. The order of the vector has to match the order at time of fitting the model, i.e. the order of the columns in mod$data$Y.

Value

A single numeric value containing the log predictive density score (LPDS) for the fitted model evaluated at the true value of the next time-point.

Author(s)

Peter Knaus peter.knaus@wu.ac.at

See Also

Other prediction functions: fitted.shrinkTVPVAR(), forecast_shrinkTVPVAR()

Examples


set.seed(123)
sim <- simTVPVAR(p = 2)
data <- sim$data

train_dat <- data[1:(nrow(data) - 1), ]
test_dat <- data[nrow(data), ]

res <- shrinkTVPVAR(train_dat, p = 2)

LPDS(res, test_dat)

res_dyn <- shrinkDTVPVAR(train_dat, p = 2)

LPDS(res_dyn, test_dat)



[Package shrinkTVPVAR version 1.0.1 Index]