Learn R Programming

BGVAR (version 2.0.1)

cond.pred: Conditional Forecasts

Description

Function that computes conditional forecasts for Bayesian Vector Autoregressions.

Usage

cond.predict(constr, bgvar.obj, pred.obj, constr_sd=NULL, verbose=TRUE)

Arguments

constr

a 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.

bgvar.obj

an item fitted by bgvar.

pred.obj

an item fitted by predict. Note that save.store=TRUE is required as argument!

constr_sd

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

verbose

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

Value

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

  • fcast is a K times fhorz times 5-dimensional array that contains 16%th, 25%th, 50%th, 75%th and 84% percentiles of the conditional posterior predictive distribution.

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

  • fhorz specified forecast horizon.

Details

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.

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

Run this code
# NOT RUN {
library(BGVAR)
data(eerData)
model.ssvs.eer<-bgvar(Data=eerData,W=W.trade0012,saves=100,burns=100,plag=1,prior="SSVS",
                      eigen=TRUE)

# compute predictions
fcast <- predict(model.ssvs.eer,fhorz=8,save.store=TRUE)

# set up constraints matrix of dimension fhorz times K
constr <- matrix(NA,nrow=fcast$fhorz,ncol=ncol(model.ssvs.eer$xglobal))
colnames(constr) <- colnames(model.ssvs.eer$xglobal)
constr[1:5,"US.Dp"] <- model.ssvs.eer$xglobal[76,"US.Dp"]

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

cond_fcast <- cond.predict(constr, model.ssvs.eer, fcast, constr_sd)
plot(cond_fcast, resp="US.Dp", Cut=10)
# }

Run the code above in your browser using DataLab