mc.irf: Monte Carlo Integration / Simulation of Impulse Response...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Simulates a posterior of impulse response functions (IRF) by Monte Carlo integration. This can handle Bayesian and frequentist VARs and Bayesian (structural) VARs estimated with the szbvar, szbsvar or reduced.form.var functions. The decomposition of the contemporaneous innovations is handled by a Cholesky decomposition of the error covariance matrix in reduced form (B)VAR object, or for the contemporaneous structure in S-VAR models. Simulations of IRFs from the Bayesian model utilize the posterior estimates for that model.

Usage

1
2
mc.irf(varobj, nsteps, draws=1000, A0.posterior=NULL,
       sign.list=rep(1, ncol(varobj$Y)))

Arguments

varobj

VAR objects for a fitted VAR model from either reduced.form.var, szbvar or szbsvar.

nsteps

Number of periods over which to compute the impulse responses

draws

Number of draws for the simulation of the posterior distribution of the IRFs (if not a szbsvar object. For the MSBVAR model, this is the value of N2 from the MCMC sampling (default). You probably should use more than the default given here.

A0.posterior

Posterior sample objects generated by gibbs.A0() for B-SVAR models, based on the structural identification in varobj$ident.

sign.list

A list of signs (length = number of variables) for normalization given as either 1 or -1.

Details

VAR/BVAR:

Draws a set of posterior samples from the VAR coefficients and computes impulse responses for each sample. These samples can then be summarized to compute MCMC-based estimates of the responses using the error band methods described in Sims and Zha (1999).

B-SVAR: Generates a set of N2 draws from the impulse responses for the Bayesian SVAR model in varobj. The function takes as its arguments the posterior moments of the B-SVAR model in varobj, the draws of the contemporaneous structural coefficients A(0) from gibbs.A0, and a list of signs for normalization. This function then computes a posterior sample of the impulse responses based on the Schur product of the sign list and the draws of A(0) and draws from the normal posterior pdf for the other coefficients in the model.

The computations are done using compiled C++ code as of version 0.3.0. See the package source code for details about the implementation.

MSBVAR:

Computes a set of regime specific impulse responses. There will be h of the m x m responses, per the discussion above (shocks in columns, equations / responses in rows. The default is for these to be presented serially. Finally, a regime averaged set of responses, based on the ergodic probability of being in each regime is presented as the "long run" responses. At present this is experimental and open to changes.

Value

VAR/BVAR:

An mc.irf.VAR or mc.irf.BVAR class object object that is the array of impulse response samples for the Monte Carlo samples

impulse

draws X nsteps X (m*m) array of the impulse responses

B-SVAR: mc.irf.BSVAR object which is an (N2, nsteps, m^2) array of the impulse responses for the associated B-SVAR model in varobj and the posterior A(0).

MS-BVAR mc.irf.MSBVAR object which is a list of two arrays. The first array are (N2, nsteps, m^2, h) array of the short-run, regime specific impulse shock-response combinations. The second array are the regime averaged, long run responses based on the ergodic regime probabilities. This second list item is an array of dimensions (N2, nsteps, m^2).

Note

Users need to think carefully about the number of steps and the size of the posterior sample in A(0), since enough memory needs to be available to store and process the posterior of the impulse responses. The number of bytes consumed by the impulse responses will be approximately m^2 x nsteps x N2 x 16 where N2 is the number of draws of A(0) from the gibbs.A0. Be sure you have enough memory available to store the object you create!

Author(s)

Patrick T. Brandt

References

Brandt, Patrick T. and John R. Freeman. 2006. "Advances in Bayesian Time Series Modeling and the Study of Politics: Theory Testing, Forecasting, and Policy Analysis" Political Analysis 14(1):1-36.

Sims, C.A. and Tao Zha. 1999. "Error Bands for Impulse Responses." Econometrica 67(5): 1113-1156.

Hamilton, James. 1994. Time Series Analysis. Chapter 11.

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

See Also

See also as plot.mc.irf for plotting methods and error band construction for the posterior of these impulse response functions, szbsvar for estimation of the posterior moments of the B-SVAR model, gibbs.A0 for drawing posterior samples of A(0) for the B-SVAR model before the IRF computations, and msbvar and gibbs.msbvar for the specification and computation of the posterior for the MSBVAR models.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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))

Example output

##
## MSBVAR Package v.0.9-2
## Build date:  Wed Nov  1 00:38:08 2017 
## Copyright (C) 2005-2017, Patrick T. Brandt
## Written by Patrick T. Brandt
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0351179, SES-0351205, SES-0540816, and SES-0921051)
##

Monte Carlo IRF Iteration = 1000
Monte Carlo IRF Iteration = 2000
Monte Carlo IRF Iteration = 3000
Monte Carlo IRF Iteration = 4000
Monte Carlo IRF Iteration = 5000
Estimating starting values for the numerical optimization
of the log posterior of A(0)
Estimating the final values for the numerical optimization
of the log posterior of A(0)
initial  value 8.731056 
final  value 8.731056 
converged
Normalization Method:  DistanceMLA ( 0 )
Gibbs Burn-in 10 % Complete
Gibbs Burn-in 20 % Complete
Gibbs Burn-in 30 % Complete
Gibbs Burn-in 40 % Complete
Gibbs Burn-in 50 % Complete
Gibbs Burn-in 60 % Complete
Gibbs Burn-in 70 % Complete
Gibbs Burn-in 80 % Complete
Gibbs Burn-in 90 % Complete
Gibbs Burn-in 100 % Complete
Gibbs Sampling 10 % Complete (100 draws)
A0 log-det 	 = -7.705272 
Gibbs Sampling 20 % Complete (200 draws)
A0 log-det 	 = -7.708311 
Gibbs Sampling 30 % Complete (300 draws)
A0 log-det 	 = -7.747621 
Gibbs Sampling 40 % Complete (400 draws)
A0 log-det 	 = -7.699357 
Gibbs Sampling 50 % Complete (500 draws)
A0 log-det 	 = -7.719407 
Gibbs Sampling 60 % Complete (600 draws)
A0 log-det 	 = -7.718144 
Gibbs Sampling 70 % Complete (700 draws)
A0 log-det 	 = -7.693222 
Gibbs Sampling 80 % Complete (800 draws)
A0 log-det 	 = -7.734632 
Gibbs Sampling 90 % Complete (900 draws)
A0 log-det 	 = -7.728900 
Gibbs Sampling 100 % Complete (1000 draws)
A0 log-det 	 = -7.775326 
Monte Carlo IRF 10 % Complete
Monte Carlo IRF 20 % Complete
Monte Carlo IRF 30 % Complete
Monte Carlo IRF 40 % Complete
Monte Carlo IRF 50 % Complete
Monte Carlo IRF 60 % Complete
Monte Carlo IRF 70 % Complete
Monte Carlo IRF 80 % Complete
Monte Carlo IRF 90 % Complete
Monte Carlo IRF 100 % Complete

MSBVAR documentation built on May 30, 2017, 1:23 a.m.

Related to mc.irf in MSBVAR...