Learn R Programming

MSBVAR (version 0.2.2)

gibbs.A0: Gibbs sampler for posterior of Bayesian structural vector autoregression models

Description

Samples from the structural contemporaneous parameter matrix $A_0$ of a Bayesian Structural Vector Autoregression (B-SVAR) model.

Usage

gibbs.A0(varobj, N1, N2, thin=1, normalization="DistanceMLA")

Arguments

Value

A list of five elements:A0.posteriorA list of three elements containing the results of the N2 $A_0$ draws. The list contains a vector storing all of the draws, the location of the drawn elements in and the dimension of $A_0$. A0.posterior$A0 is a vector of length equal to the number of parameters in $A_0$ times N2. A0.posterior$struct is a vector of length equal to the number of free parameters in $A_0$ that gives the index positions of the elements in $A_0$. A0.posterior$m is $m$, an integer, the number of equations in the system.W.posteriorA list of three elements that describes the vectorized $W$ matrices that characterize the covariance of the restricted parameter space of each column of $A_0$. W.posterior$W is a vector of the elements of all the sampled $W$ matrices. W.posterior$W.index is a cumulative index of the elements of $W$ that defines how the $W$ matrices for each iteration of the sampler are stored in the vector. W.posterior$m is $m$, an integer, the number of equations in the system.identident matrix from the varobj of binary elements that defined the free and restricted parameters, as specified in szbsvarthinthin value that was input into the function for thinning the Gibbs sampler.N2N2, size of the posterior sample.

Details

Samples the posterior pdf of an $A_0$ matrix for a Bayesian structural VAR using the algorithm described in Waggoner and Zha (2003a). This function is meant to be called after szbsvar, so one should consult that function for further information. The function draws N2 * thin draws from the sampler and returns the N2 draws that are the thin'th elements of the Gibbs sampler sequence.

References

Waggoner, Daniel F. and Tao A. Zha. 2003a. "A Gibbs sampler for structural vector autoregressions" Journal of Economic Dynamics & Control. 28:349--366.

Waggoner, Daniel F. and Tao A. Zha, 2003b. "Likelihood Preserving Normalization in Multiple Equation Models" Journal of Econometrics, 114: 329--347

See Also

szbsvar for estimation of the posterior moments of the B-SVAR model,

normalize.svar for a discussion of and references on $A_0$ normalization. posterior.fit for computing the marginal log likelihood for the model after sampling the posterior

Examples

Run this code
varobj <- szbsvar(Y, p, z = NULL, lambda0, lambda1, lambda3, lambda4,
                  lambda5, mu5, mu6, ident, qm = 4)
N1 <- 100
N2 <- 1000
A0posterior.obj <- gibbs.A0(varobj, N1, N2, thin=10)

# Use coda to look at the posterior.
library(coda)
A0.free <- A02mcmc(A0.posterior.obj)

plot(A0.free)

Run the code above in your browser using DataLab