bgvar {BGVAR}  R Documentation 
Estimation of Bayesian GVAR
Description
Estimates a Bayesian GVAR with either the Stochastic Search Variable Selection (SSVS), the Minnesota prior (MN), the NormalGamma (NG), or the Horseshoe (HS) prior. All specifications can be estimated with stochastic volatility.
Usage
bgvar(Data, W, plag=1, draws=5000, burnin=5000, prior="NG", SV=TRUE, hold.out=0, thin=1,
hyperpara=NULL, eigen=TRUE, Ex=NULL, trend=FALSE, expert=NULL, verbose=TRUE)
Arguments
Data 
Either a

W 
An N times N weight matrix with 0 elements on the diagonal and row sums that sum up to unity or a list of weight matrices. 
plag 
Number of lags used. Either a single value for domestic and weakly exogenous, or a vector of length two. Default set to 
draws 
Number of retained draws. Default set to 
burnin 
Number of burnins. Default set to 
prior 
Either 
SV 
If set to 
hold.out 
Defines the holdout sample. Default without holdout sample, thus set to zero. 
thin 
Is a thinning interval of the MCMC chain. As a rule of thumb, workspaces get large if draws/thin>500. Default set to 
hyperpara 
Is a list object that defines the hyperparameters when the prior is set to either

eigen 
Set to TRUE if you want to compute the largest eigenvalue of the companion matrix for each posterior draw. If the modulus of the eigenvalue is significantly larger than unity, the model is unstable. Unstable draws exceeding an eigenvalue of one are then excluded. If 
Ex 
For including truly exogenous variables to the model. Either a

trend 
If set to 
expert 
Expert settings, must be provided as list. Default is set to

verbose 
If set to 
Details
We provide three priors, the Minnesota labeled MN
, the Stochastic Search Variable Selection prior labeled SSVS
and the NormalGamma prior labeled NG
. The first one has been implemented for global VARs in Feldkircher and Huber (2016) and the second one in Crespo Cuaresma et al. (2016), while the last one has been introduced to VAR modeling in Huber and Feldkircher (2019).
Please consult these references for more details on the specification. In the following we will briefly explain the difference between the three priors. The Minnesota prior pushes the variables in the countryspecific VAR towards their unconditional stationary mean, or toward a situation where there is at least one unit root present. The SSVS prior is a form of a 'spike' and 'slab' prior. Variable selection is based on the probability of assigning the corresponding regression coefficient to the 'slab' component. If a regression coefficient is non informative, the 'spike' component pushes the associated posterior estimate more strongly towards zero. Otherwise, the slab component resembles a noninformative prior that has little impact on the posterior. Following George et. al. (2008) we set the prior variances for the normal distribution in a semiautomatic fashion. This implies scaling the mixture normal with the OLS standard errors of the coefficients for the full model. The NG prior is a form of globallocal shrinkage prior. Hence, the local component shrinks each coefficient towards zero if there is no information for the associated dependent variable. Otherwise, the prior exerts a fattail structure such that deviations from zero are possible. The global component is present for each lag, thus capturing the idea that higher lags should be shrunk more aggressively towards zero.
Value
Returns a list of class bgvar
with the following elements:
args
is a list object that contains the arguments submitted to function
bgvar
.xglobal
is a matrix object of dimension T times N (T # of observations, K # of variables in the system).
gW
is the global weight matrix. It is a list, with
N
entries, each of which contains the weight matrix of each country.country.res
is a matrix that contains the posterior mean of the country models' residuals. The residuals have been obtained as a running mean and thus always relate to the full set of posterior draws. This implies that in case you have opted for trimming the draws the residuals do not correspond to the posterior draws of the "trimmed" coefficients. This is a storage problem, rather than a statistical problem. Experiments, however, show that residual properties (autocorrelation, crosssectional correlation) of trimmed and reported residuals are close.
stacked results

S_large
is a threedimensional array (K times K times draws) of the (blockdiagonal) posterior variance covariance matrix.
F_large
is a fourdimensional array (K times K times lags times draws) of the coefficients.
Ginv_large
is a threedimensional array (K times K times draws) of the inverse of the G matrix.
A_large
is a threedimensional array (K times K+1 times draws) of the posterior estimates for the K coefficients plus a global constant.
F.eigen
in case
eigen="TRUE"
, returns a vector that contains for each posterior draw the modulus of the largest eigenvalue of the companion matrix.trim.info
is a character vector. Contains information regarding the nr. of stable draws out of total (thinned) draws. Experience shows that a maximum eigenvalue of
1.05
seems a reasonable choice when working with data in levels to generate stable impulse responses.
cc.results
each entry of this list contains an list object of length
N
. Each entry in the list corresponds to one country model and contains one of the following posterior medians.coeffs
contains in each entry the matrix with the posterior median of the estimated coefficients. Columns of the matrix correspond to an equation in the country model (i.e., the dependent variable) and rows to coefficient estimates of the explanatory variables.
sig
contains in each entry the variancecovariance matrix for each point in time. If
SV=FALSE
all entries along the time dimension are the same.theta
contains in each entry the estimated prior variances for the coefficients. Explains how much shrinkage is induced on each coefficient depending on the prior setup.
res
contains in each entry a matrix of dimension (Tp times K) with the posterior median of the residuals of the crosscountry models.
shrink
in case
prior="MN"
each entry contains the estimated shrinkage parameters.PIP
in case
prior="SSVS"
returns a list object. The first slot in the listPIP.cc
, is a list of lengthN
and contains the posterior inclusion probabilities of the country models. The second slot in the list, namedPIP.avg
yields simple averages (over the country models where a particular variable has been included) of the posterior inclusion probabilities.lambda2
in case
prior="NG"
each entry contains the estimated global shrinkage parameters. It is a matrix of dimension (p+1 times 3). Columns refer to the endogenous, weakly exogenous and shrinkage parameters for the covariances. Rows correspond to different degree of shrinkage per lag of the variables starting with the contemporaneous lag (only for weakly exogenous variables). In case of the covariances just one global shrinkage parameter is estimated.tau
in case
prior="NG"
each entry contains the estimated parameter that governs the heaviness of the tails of the marginal prior distribution of the coefficients associated to endogenous variables. Structure is the same aslambda2
.
Author(s)
Maximilian Boeck, Martin Feldkircher, Florian Huber
References
Boeck, M., Feldkircher, M. and F. Huber (2022) BGVAR: Bayesian Global Vector Autoregressions with Shrinkage Priors in R. Journal of Statistical Software, Vol. 104(9), pp. 128.
Crespo Cuaresma, J., Feldkircher, M. and F. Huber (2016) Forecasting with Global Vector Autoregressive Models: A Bayesian Approach. Journal of Applied Econometrics, Vol. 31(7), pp. 13711391.
Doan, T. R., Litterman, B. R. and C. A. Sims (1984) Forecasting and Conditional Projection Using Realistic Prior Distributions. Econometric Reviews, Vol. 3, pp. 1100.
Dovern, J., Feldkircher, M. and F. Huber (2016) Does joint modelling of the world economy pay off? Evaluating multivariate forecasts from a Bayesian GVAR. Journal of Economic Dynamics and Control, Vol. 70, pp. 86100.
Feldkircher, M. and F. Huber (2016) The International Transmission of US Shocks  Evidence from Bayesian Global Vector Autoregressions. European Economic Review, Vol. 81, pp. 167188.
Feldkircher, M. Gruber, T. and F. Huber (2020) International effects of a compression of euro area yield curves. Journal of Banking & Finance, Vol. 113, pp. 1114.
George, E.I., Sun, D. and S. Ni (2008) Bayesian stochastic search for var model restrictions. Journal of Econometrics, Vol. 142, pp. 553580.
Georgiadis, G. (2015) Examining asymmetries in the transmission of monetary policy in the euro area: Evidence from a mixed crosssection global VAR model. European Economic Review, Vol. 75, pp. 195215.
Huber, F. and M. Feldkircher (2016) Adaptive Shrinkage in Bayesian Vector Autoregressive Models. Journal of Business and Economic Statistics, Vol. 37(1), pp. 2739.
Mohaddes, K. and M. Raissi (2018). Compilation, Revision and Updating of the Global VAR (GVAR) Database, 1979Q22016Q4. University of Cambridge: Faculty of Economics (mimeo).
Mohaddes, K. and M. Raissi (2019) The US oil supply revolution and the global economy. Empirical Economics, Vol. 57, pp. 515546.
Pesaran, M.H., Schuermann T. and S.M. Weiner (2004) Modeling Regional Interdependencies Using a Global ErrorCorrecting Macroeconometric Model. Journal of Business and Economic Statistics, Vol. 22, pp. 129162.
Sims, C. A. (1992) Bayesian Inference for Multivariate Time Series with Trend. Mimeo, presented at the American statistical Association meeting.
Sims, C.A. and T. Zha (1998) Bayesian Methods for Dynamic Multivariate Models. International Economic Review, Vol. 39, pp. 949968.
Examples
library(BGVAR)
data(testdata)
hyperpara < list(tau0=0.1,tau1=3,kappa0=0.1,kappa1=7,a_1=0.01,b_1=0.01,p_i=0.5,q_ij=0.5)
model.ssvs < bgvar(Data=testdata,W=W.test,plag=1,draws=100,burnin=100,
prior="SSVS",SV=FALSE,hyperpara=hyperpara,thin=1)
## Not run:
library(BGVAR)
# replicate Feldkircher and Huber (2016) using trade based weights
data(eerData)
hyperpara < list(tau0=0.1,tau1=3,kappa0=0.1,kappa1=7,a_1=0.01,b_1=0.01,p_i=0.5,q_ij=0.5)
model.ssvs < bgvar(Data=eerData,W=W.trade0012,plag=1,draws=100,burnin=100,
prior="SSVS",SV=FALSE,hyperpara=hyperpara,thin=1)
print(model.ssvs)
# use different weight matrices
variable.list<list();variable.list$real<c("y","Dp","tb");variable.list$fin<c("stir","ltir","rer")
model.mn < bgvar(Data=eerData, W=W.list[c("tradeW.0012","finW0711")], plag=1, draws=200,
burnin=100,prior="MN",SV=TRUE,thin=2,expert=list(variable.list=variable.list))
print(model.mn)
data(monthlyData)
cN = names(EB.weights$weights)
Data = monthlyData[c(cN,"EB","OC")]
W = W[cN,cN]
OC.weights$weights = OC.weights$weights[cN]
OE.weights < list(EB=EB.weights, OC=OC.weights)
hyperpara<list(d_lambda = 0.01, e_lambda = 0.01,e_lambda=1.5,d_lambda=1,
prmean=0,a_1=0.01,b_1=0.01,tau_theta=.6,sample_tau=FALSE)
model.ssvs < bgvar(Data=Data,W=W,plag=2,draws=100,burnin=100,prior="SSVS",
hyperpara=hyperpara,eigen=TRUE,SV=TRUE,expert=list(OE.weights=OE.weights))
print(model.ssvs)
## End(Not run)