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)

Arguments

mydata

the time series used for estimating the VAR model

priorObj

a S3-object containing information about the prior

stabletest

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

nreps

number of draws for the mcmc sampler

burnin

number of burnin-draws

nthin

thinning parameter

Value

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.

Details

This is the main function for estimating a Bayesian Vectorautoregressive model. The user has to supply the data by mydata and a previously defined prior via priorObj. Several standard priors such as the Minnesota prior or the Independent Normal-Wishart are provided and the user has to parameterize them.

See also

msvar for regime switching models and tvar for threshold models.