Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predict

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

the forecast horizon.

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.

constr_sd

a 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(eerDatasmall)
model.ssvs <- bgvar(Data=eerDatasmall,W=W.trade0012.small,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

Bayesian Global Vector Autoregressions

v2.2.0
GPL-3
Authors
Maximilian Boeck [aut, cre] (<https://orcid.org/0000-0001-6024-8305>), Martin Feldkircher [aut] (<https://orcid.org/0000-0002-5511-9215>), Florian Huber [aut] (<https://orcid.org/0000-0002-2896-7921>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.