forecast_shrinkTVP: Draw from posterior predictive density of a fitted TVP model

View source: R/pred_funs.R

forecast_shrinkTVPR Documentation

Draw from posterior predictive density of a fitted TVP model

Description

forecast_shrinkTVP draws from the posterior predictive distribution of a fitted TVP model resulting from a call to shrinkTVP.

Usage

forecast_shrinkTVP(mod, newdata, n.ahead)

Arguments

mod

an object of class shrinkTVP, containing the fitted model.

newdata

a data frame containing the future covariates. The names of the covariates have to match the names used during model estimation in the call to shrinkTVP.

n.ahead

a single, positive integer indicating the forecasting horizon, i.e. how many time-points into the future the posterior predictive distribution should be sampled from. Can not be larger than the number of rows in newdata.

Value

The value returned is a list object of class shrinkTVP_forc containing the samples from the posterior predictive density.

Author(s)

Peter Knaus peter.knaus@wu.ac.at

See Also

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

Examples


# 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:190, ])

# Forecast
forc <- forecast_shrinkTVP(res, data[191:200, ])

# Plot
plot(forc)



shrinkTVP documentation built on May 29, 2024, 7:24 a.m.