bgvar {BGVAR}R Documentation

Estimate a Bayesian GVAR

Description

Estimates a Bayesian GVAR with either the Stochastic Search Variable Selection (SSVS), the Sims and Zha prior, or the Normal-Gamma prior with stochastic volatility.

Usage

bgvar(Data,W,Wex.restr=NULL,saves=5000,burns=5000,plag=2,hyperparm=NULL,Cpu=4,prior="SSVS",save_thin=.1,eigen=FALSE,logfile=FALSE,stats=FALSE,trend=FALSE,trim=NULL,SV="SV.M",ea.weights=NULL,OC.weights=NULL,variable.list=NULL)

Arguments

Data

A list of length N that contains the data. Each element of the list refers to a country. The number of columns (i.e., variables) in each country model can be different. The rows (i.e., number of time observations), however, need to be the same for each country.

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. See the help files for getweights for more details.

Wex.restr

A character vector that contains variables that should only be specified as weakly exogeneous if not contained as endogeneous variable in a particular country. An example that has often been used in the literature is to place these restrictions on nominal exchange rates. Default is NULL in which case all weakly exogeneous variables are treated symmetrically. See function getweights for more details.

saves

Number of draws saved.

burns

Number of burn-ins.

plag

Number of lags used (the same for domestic, exogenous and weakly exogenous variables).

hyperparm

Is a list object that defines the hyperparameters when the prior is set to either SSVS or NG.

  • "SSVS"

    • tau0 is the prior variance associated with the normal prior on the regression coefficients if a variable is NOT included (spike, tau0 should be close to zero)

    • tau1 is the prior variance associated with the normal prior on the regression coefficients if a variable is included (slab, tau1 should be large)

    • kappa0 is the prior variance associated with the normal prior on the covariances if a covariance equals zero (spike, kappa0 should be close to zero)

    • kappa1 is the prior variance associated with the normal prior on the covariances if a covariance is unequal to zero (slab, kappa1 should be large)

    • a_i is the prior hyperparameter for the inverted gamma prior (shape) (set a_i = b_i to a small value for the standard uninformative prior)

    • b_i is the prior hyperparameter for the inverted gamma prior (rate)

  • "NG":

    • c_tau Prior hyperparameter for the prior on the global shrinkage parameter associated to the covariance parameters, standard value is c_tau=0.01.

    • d_tau Prior hyperparameter for the prior on the global shrinkage parameter associated to the covariance parameters, standard value is d_tau=0.01.

    • e_lambda Prior hyperparameter for the Gamma prior on the lag-specific shrinkage components, standard value is e_lambda=1.5.

    • d_lambda Prior hyperparameter for the Gamma prior on the lag-specific shrinkage components, standard value is d_lambda=1.

    • a_start Parameter of the Normal-Gamma prior that governes the heaviness of the tails of the prior distribution. A value of a_start=1 would lead to the Bayesian LASSO. standard value is a_start=0.6. If set to sample_A=TRUE.

    • sample_A If set to TRUE a_start is sampled.

    • prmeanPrior mean on the first lag of the autoregressive coefficients, standard value is prmean=1 for non-stationary data. Prior mean for the remaining autoregressive coefficients automatically set to 0.

    • a_i is the prior hyperparameter for the inverted gamma prior (shape) (set a_i = b_i to a small value for the standard uninformative prior)

    • b_i is the prior hyperparameter for the inverted gamma prior (rate)

Cpu

The number of computer cores used to estimate the model. If Cpu>1 then the package snowfall is involved and the gvar is estimated using parallel computation.

prior

Either "SSVS", "SIMS" or "NG". See Details below.

save_thin

Is a thinning interval which grabs save_thin percent of your posterior output. As a rule of thumb, workspaces get large if save_thin*saves>500.

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.

logfile

The logfile logs the start of the estimation of the country models and the start of stacking the models together.

stats

If TRUE the log likelihood of the global model is computed. Significantly slows the computation down (in the stacking part of the model).

trend

set to TRUE if trend should be included. Only implemented with prior="SSVS".

trim

If eigen was set to TRUE in bgvar, unstable draws can be excluded prior to calculating impulse responses. A typical value to set trim would be 1.05 (which excludes all posterior draws for which the eigenvalue of the companion matrix was larger than 1.05 in modulus).

SV

If set to "SV.M", models are fitted with stochastic volatility using the stochvol and GIGrvg packages. Due to storage issues, not the whole history of the T variance covariance matrices are kept, only either the mean ("SV.M") or the last data point in the sample ("SV.T"). Consequently, the BGVAR package shows only one set of impulse responses (with variance covariance matrix based on mean or last sample point volatilities) instead of T sets. Specify SV=NULL to turn SV off.

ea.weights

To model the common monetary policy in the euro area, it is possible to augment the GVAR countries by a country model for the ECB. It is important that this country model is labeled 'EB'. Akin to Georgidas (2015) one can use a Taylor rule to determine interest rates in the euro area. The Taylor rule typically relates short-term interest rates to a weighted average of output y and prices p. ea.weights is a list whith the first slot (ea.weights$weights) containing a vector of weights to aggregate single euro area countrys' output and price figures. In the example using the monthlyData set, we use purchasing power parity weights. The second slot (ea.weights$variables) contains a character vector that specifies the variables which should enter the Taylor rule (typically output and prices). One can also use a broader set of variables to model the common monetary policy. In that case the 'EB' model is a VAR as opposed to a univariate Taylor-rule type regression. One can also specify which of the variables determined within the 'EB' model should be introduced in the other country models as exogeneous variable by specifying a character vector in ea.weights$exo. In case ea.weights$exo is NULL all variables of the 'EB' model enter as exogeneously in the other country models. Set ea.weights=NULL to proceed without the ECB country model.

OC.weights

This feature is very similar to EA.weights above and should be specified if an own country model for the oil price should be included – as opposed to having oil prices attached to a particular country model, as is standard in the literature. It is important that the country model is labeled 'OC'. Again, OC.weights is a list of length 3, the first slot should be a vector of weights to aggregate variables, the second one the variables to aggregate and the third which of the endogeneous variables in the 'OC' model should be introduced exogeneously into the other country models. The vector of weights should have country names attached to it. In the example using the monthlyData2 set, we use purchasing power parity weights to aggregate world output to resemble demand for oil. Set OC.weights=NULL to proceed without the oil country model.

variable.list

In case W is a list of weight matrices, specify here which set of variables should be weighted by which weight matrix. See the help file on getweights for details. Default is NULL-

Details

We provide two priors, the SSVS and the Sims and Zha prior, the former has been implemented for global VARs in Feldkircher and Huber (2016) and the latter in Crespo Cuaresma et al. (2016). Please consult these references for more details on the specification. In the following we will briefly explain the difference between the two priors. For that purpose it proves convenient to work with the stacked matrix of coefficients for country i, Ξ_i = (a_{i,0},a_{i,1},vec(ψ_{i,1})', vec(Λ_{i,0})',vec(Λ_{i,1})')'. The SSVS-prior adovacted in George et al. (2008) does model selection by shrinking "unimportant" coefficients to zero. More precisely, it assumes a mixture normal prior on each coefficient

Ξ_{i,j}|δ_{i,j} \sim δ_{i,j} \mathcal{N}(0,τ_{i,0}^2) + (1-δ_{i,j})\mathcal{N}(0,τ_{i,1}^2)

where δ_{i,j} is a binary random variable which equals 1 if variables j is included in country model i and zero otherwise. The above mixture prior belongs to the class of 'spike and slab' priors which are frequently used for Bayesian variable selection. Here, we follow George et al. (2008) and choose a hierarchical setting in which δ_{i,j} is a random variable that has to be estimated. Typically, τ_{i,0} >> τ_{i,1}, which implies that the 'spike' is tightly centered at zero. Variable selection is based on the probability of assigning the corresponding regression effect to the 'slab' component. That is, for small coefficients the 'spike' component applies, pushing the associated posterior estimate more strongly towards zero. For the remaining coefficients, the slab component resembles a non-informative prior that has little impact on the posterior. Following George et al. (2008) we set the prior variances for the normal distributions in a semi-automatic fashion. This implies scaling the mixture normal with the OLS standard errors of the coefficients for the full model.

The Sims and Zha prior combines three so-called random walk priors assuming that under the prior model, the variables in the system follow simple random walks. These are the dummy initial observation prior (sims, 1992) which pushes the variables in the country-specific VAR towards their unconditional (stationary) mean, or toward a situation where there is at least one unit root present, the "sum of coefficients" prior, which softly forces the posterior distribution towards a specification in first differences. This implies that coefficients associated with own, lagged variables in each equation should sum to unity while other coefficients are being pushed towards zero and finally the Minnesota prior (Doan,) that punishes higher lag orders. As in Sims and Zha (1998) and Crespo Cuaresma et al. (2016) the hyperparameters are chosen by maximizing the marginal likelihood of the individual country models a-priori with respect to the hyperparameters. This implies that no user-input is needed when prior="SIMS".

Value

Author(s)

Martin Feldkircher and Florian Huber

References

Crespo Cuaresma, J., Feldkircher, M. and F. Huber (2016) Forecasting with Global Vector Autoregressive Models: A Bayesian Approach. In: Journal of Applied Econometrics, Vol. 31, Issue 7, pp. 1371-1391.

Doan, T. R., Litterman, B. R. and C. A. Sims (1984) Forecasting and Conditional Projection Using Realistic Prior Distributions. In: Econometric Reviews 3, pp. 1-100.

Dovern, J., Feldkircher, M. and F. Huber (2016) Does joint modelling of the world economy pay off? Evaluating multivariate forecasts from a Bayesian GVAR. In: Journal of Economic Dynamics and Control, Volume 70, September 2016, pages 86-100.

Feldkircher, M. and F. Huber (2016) The International Transmission of US Shocks - Evidence from Bayesian Global Vector Autoregressions. In: European Economic Review, Vol. 81, pages 167-188.

George, E.I., Sun, D. and S. Ni (2008) Bayesian stochastic search for var model restrictions. In: Journal of Econometrics, Vol. 142, pp. 553-580.

Georgiadis, G. (2015) Examining asymmetries in the transmission of monetary policy in the euro area: Evidence from a mixed cross-section global VAR model. In: European Economic Review, Vol. 75, pp. 195-215.

Huber, F. and M. Feldkircher (2016) Adaptive Shrinkage in Bayesian Vector Autoregressive Models. In: Journal of Business and Economic Statistics, http://dx.doi.org/10.1080/07350015.2016.1256217, forthcoming.

Pesaran, M.H., Schuermann T. and S.M. Weiner (2004) Modeling Regional Interdependencies Using a Global Error-Correcting Macroeconometric Model. In: Journal of Business and Economic Statistics, American Statistical Association Vol. 22, pp. 129-162.

Sims, C. A. (1992) Bayesian Inference for Multivariate Time Series with Trend. In: Mimeo, presented at the American statistical Association meeting.

Sims, C.A. and T. Zha (1998) Bayesian Methods for Dynamic Multivariate Models. In: International Economic Review Vol. 39, pp. 949-968.

Examples

library(BGVAR)


# replicate Feldkircher and Huber (2016) using 4 cpu cores with trade based weights
data(eerData)
Hyperparm <- list(tau0=0.1,tau1=3,kappa0=0.1,kappa1=7,a_i=0.01,b_i=0.01,p_i=0.5,q_ij=0.5)
model.ssvs<-bgvar(Data=eer.data,W=W.trade0012,saves=100,burns=100,plag=1,hyperparm=Hyperparm,Cpu=4,prior="SSVS",save_thin=1,eigen=TRUE,logfile=FALSE,stats=TRUE,SV=NULL)
print.bgvar(model.ssvs)

# Sims Zha prior and two different weight matrices and no SV
# weights for first variable set tradeW.0012, for second finW0711
variable.list<-list();variable.list$real<-c("y","Dp","tb");variable.list$fin<-c("stir","ltir","rer")
model.SIMS<-bgvar(Data=eer.data,W=W.list[c("tradeW.0012","finW0711")],saves=100,burns=100,plag=1,hyperparm=Hyperparm,Cpu=4,prior="SIMS",save_thin=1,eigen=TRUE,logfile=FALSE,stats=TRUE,SV=NULL, variable.list=variable.list)
print.bgvar(model.SIMS)


# monthly data set, euro area single countries
data(monthlyData)
hyperparm<-list(c_tau = 0.01, d_tau = 0.01,e_lambda=1.5,d_lambda=1, prmean=0,a_i=0.01,b_i=0.01,a_start=.6,sample_A=FALSE)#standard setting
model.ng<-bgvar(Data=new.data,W=W,saves=1000,burns=1000,plag=2,hyperparm=hyperparm,Cpu=4,prior="NG",save_thin=0.5,eigen=TRUE,stats=TRUE,SV="SV.M")
print.bgvar(model.ng)




[Package BGVAR version 1.1.3 Index]