predict: Predictions

predictR Documentation

Predictions

Description

A function that computes predictions and conditional predictions based on a object of class bgvar.

Usage

## S3 method for class 'bgvar'
predict(
  object,
  ...,
  n.ahead = 1,
  constr = NULL,
  constr_sd = NULL,
  quantiles = NULL,
  save.store = FALSE,
  verbose = TRUE
)

Arguments

object

An object of class bgvar.

...

Additional arguments.

n.ahead

Forecast horizon.

constr

Matrix containing the conditional forecasts of size horizon times K, where horizon corresponds to the forecast horizon specified in pred.obj, while K is the number of variables in the system. The ordering of the variables have to correspond the ordering of the variables in the system. Rest is just set to NA.

constr_sd

Matrix containing the standard deviations around the conditional forecasts. Must have the same size as constr.

quantiles

Numeric vector with posterior quantiles. Default is set to compute median along with 68%/80%/90% confidence intervals.

save.store

If set to TRUE the full distribution is returned. Default is set to FALSE in order to save storage.

verbose

If set to FALSE it suppresses printing messages to the console.

Details

Predictions are performed up to an horizon of n.ahead. Note that conditional forecasts need a fully identified system. Therefore this function utilizes short-run restrictions via the Cholesky decomposition on the global solution of the variance-covariance matrix of the Bayesian GVAR.

Value

Returns an object of class bgvar.pred with the following elements

fcast

is a K times n.ahead times Q-dimensional array that contains Q quantiles of the posterior predictive distribution.

xglobal

is a matrix object of dimension T times N (T # of observations, K # of variables in the system).

n.ahead

specified forecast horizon.

lps.stats

is an array object of dimension K times 2 times n.ahead and contains the mean and standard deviation of the log-predictive scores for each variable and each forecast horizon.

hold.out

if h is not set to zero, this contains the hold-out sample.

Author(s)

Maximilian Boeck, Martin Feldkircher, Florian Huber

References

Jarocinski, M. (2010) Conditional forecasts and uncertainty about forecasts revisions in vector autoregressions. Economics Letters, Vol. 108(3), pp. 257-259.

Waggoner, D., F. and T. Zha (1999) Conditional Forecasts in Dynamic Multivariate Models. Review of Economics and Statistics, Vol. 81(4), pp. 639-561.

Examples

library(BGVAR)
data(testdata)
model.ssvs <- bgvar(Data=testdata,W=W.test,plag=1,draws=100,burnin=100,
                    prior="SSVS")
fcast <- predict(model.ssvs, n.ahead=8)

# conditional predictions
# et up constraints matrix of dimension n.ahead times K
constr <- matrix(NA,nrow=8,ncol=ncol(model.ssvs$xglobal))
colnames(constr) <- colnames(model.ssvs$xglobal)
constr[1:5,"US.Dp"] <- model.ssvs$xglobal[76,"US.Dp"]

# add uncertainty to conditional forecasts
constr_sd <- matrix(NA,nrow=8,ncol=ncol(model.ssvs$xglobal))
colnames(constr_sd) <- colnames(model.ssvs$xglobal)
constr_sd[1:5,"US.Dp"] <- 0.001

fcast_cond <- predict(model.ssvs, n.ahead=8, constr=constr, constr_sd=constr_sd)

BGVAR documentation built on July 4, 2024, 1:06 a.m.