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 |
y_true |
a numeric vector of length |
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)