bvar: Estimate a bayesian vector autoregressive model.

Description Usage Arguments Value See Also

View source: R/bvar.r


This function is the main function to estimate a bayesian VAR model for the TxK series mydata. To estimate a bayesian VAR model to user first has to choose a prior and select the parmameters for it and submit it to the function via priorObj. It should be noted that the data submitted to the bvar function and the prior have to be the same. The logical parameter stabletest tells the function whether to check if a draw of coefficients is stable, i.e. if the largest eigenvalue of the companion matrix smaller than 1. Furthermore, the parameters nreps, burnin and nthin determine the number of mcmc-draws and the how many of the draws are retained. The number of retained draws is (nreps - burnin)/nthin.


bvar(mydata, priorObj, stabletest = FALSE, nreps = 15000,
  burnin = 5000, nthin = 1)



the time series used for estimating the VAR model


a S3-object containing information about the prior


logical, flag to test whether a draw is stable or not


number of draws for the mcmc sampler


number of burnin-draws


thinning parameter


returns an S3 object of the class "bvar" with the following fields

'general_info' list with general information about the model

'intercept' whether the model has an intercept or not

'nolags' number of lags in the model

'nreps' total number of draws

'burnin' number of burn-in draws

'nthin' the thinning parameter

'data_info' information about the data

'type' type of the data object (can be ts, xts or matrix)

'var_names' variable names

'mydata' the data itself

'mcmc_draws' the draws from the mcmc algortithm

'Alpha' an (K * p + Intercept) x K x (nreps - burnin) / nthin matrix with the draws for the VAR-coefficients. With K being the number of variables, p the number of lags and Intercept is 1 if the model has an intercept and 0 otherwise.

'Sigma' an K x K x (nreps - burnin) / nthin - matrix with the draws of the Variance-Covariance matrix

'additional_info' an array of length (nreps - burnin) / nthin of lists with any additional information returned by the posterior.

See Also

msvar for regime switching models and tvar for threshold models.

joergrieger/bvar documentation built on Sept. 11, 2019, 12:05 a.m.