View source: R/shrinkTVPVAR_methods.R
| LPDS | R Documentation |
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.
LPDS(mod, y_true)
mod |
an object of class |
y_true |
a numeric vector of length |
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.
Peter Knaus peter.knaus@wu.ac.at
Other prediction functions:
fitted.shrinkTVPVAR(),
forecast_shrinkTVPVAR()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.