# Example 1
data(IsraelPalestineConflict)
varnames <- colnames(IsraelPalestineConflict)
fit.BVAR <- szbvar(Y=IsraelPalestineConflict, p=6, z=NULL,
lambda0=0.6, lambda1=0.1,
lambda3=2, lambda4=0.25, lambda5=0, mu5=0,
mu6=0, nu=3, qm=4,
prior=0, posterior.fit=FALSE)
# Draw from the posterior pdf of the impulse responses.
posterior.impulses <- mc.irf(fit.BVAR, nsteps=10, draws=5000)
# Plot the responses
plot(posterior.impulses, method=c("Sims-Zha2"), component=1,
probs=c(0.16,0.84), varnames=varnames)
# Example 2
ident <- diag(2)
varobj <- szbsvar(Y=IsraelPalestineConflict, p=6, z = NULL,
lambda=0.6, lambda1=0.1, lambda3=2, lambda4=0.25,
lambda5=0, mu5=0, mu6=0, ident, qm = 4)
A0.posterior <- gibbs.A0(varobj, N1=1000, N2=1000)
# Note you need to explcitly reference the sampled A0.posterior object
# in the following call for R to find it in the namespace!
impulse.sample <- mc.irf(varobj, nsteps=12, A0.posterior=A0.posterior)
plot(impulse.sample, varnames=colnames(IsraelPalestineConflict),
probs=c(0.16,0.84))
Run the code above in your browser using DataLab