bvartools
comes with the functionality to set up and
produce posterior draws for multiple models in an effort to reduce the
time required for this potentially laborious process. This vignette
illustrates how the package can be used to set up multiple models,
produce prior specifications, obtain posterior draws and select the
model with the best fit in a few steps.
For this illustrations the data set E1 from Lütkepohl (2006) is used. It contains data on West German fixed investment, disposable income and consumption expenditures in billions of DM from 1960Q1 to 1982Q4. Like in the textbook only the log-differenced series up to 1978Q4 are used.
Functions gen_var
can be used to obtain a list of
different model specifications. In the following example five models
with an intercept and increasing lag orders are generated.
All objects use the same amounts of available observations to ensure consistency for the calculation of information criteria for model selection.
Function add_priors
can be used to produce priors for
each of the models in object models
.
Posterior draws can be obtained using function
draw_posterior
. The function allows to specify the number
of CPUs, which are available for parallel computing.
If multiple models are estimated the function produces an object of
class bvarlist
, which is a list of objects of class
bvar
. Thus, each element of the list can be used for
further analysis.
If function summary
is applied to an object of class
bvarlist
, it produces a table of information criteria for
each specification. The information criteria are calculated based on the
posterior draws of the respective model and calculated in the following
way:
\(K\) is the number of endogenous variables and \(p\) the lag order of the model. If exogenous variables were used \(M\) is the number of stochastic exogenous regressors and \(s\) is the lag order for those variables. \(N\) is the number of deterministic terms.
summary(object)
#> p s LL AIC BIC HQ
#> 1 0 0 -420.5955 843.1909 845.4536 844.0907
#> 2 1 0 -413.5161 835.0323 844.0830 838.6314
#> 3 2 0 -405.9250 825.8500 841.6887 832.1485
#> 4 3 0 -408.6642 837.3284 859.9552 846.3264
#> 5 4 0 -406.7913 839.5825 868.9974 851.2799
Since all information criteria have the lowest value for the model
with \(p = 2\), the third element of
object
is used for further analyis.
Chan, J., Koop, G., Poirier, D. J., & Tobias, J. L. (2019). Bayesian Econometric Methods (2nd ed.). Cambridge: University Press.
Lütkepohl, H. (2006). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.