Learn R Programming

shrinkTVP (version 3.0.1)

LPDS: Calculate the Log Predictive Density Score for a fitted TVP model

Description

LPDS calculates the one-step ahead Log Predictive Density Score (LPDS) of a fitted TVP model resulting from a call to shrinkTVP For details on the approximation of the one-step ahead predictive density used, see the vignette.

Usage

LPDS(mod, data_test)

Value

A real number equaling the calculated LPDS.

Arguments

mod

an object of class shrinkTVP, containing the fitted model for which the LPDS should be calculated.

data_test

a data frame with one row, containing the one-step ahead covariates and response. The names of the covariates and the response have to match the names used during model estimation in the call to shrinkTVP.

Author

Peter Knaus peter.knaus@wu.ac.at

See Also

Other prediction functions: eval_pred_dens(), fitted.shrinkTVP(), forecast_shrinkTVP(), predict.shrinkTVP(), residuals.shrinkTVP()

Examples

Run this code
# \donttest{
# Simulate data
set.seed(123)
sim <- simTVP(theta = c(0.2, 0, 0), beta_mean = c(1.5, -0.3, 0))
data <- sim$data

# Estimate model
res <- shrinkTVP(y ~ x1 + x2, data = data[1:199, ])

# Calculate LPDS
LPDS(res, data[200,])
# }

Run the code above in your browser using DataLab