Variance Decomposition in SW2007 (code vs paper)

Dear Johannes and Dynare Community,

I am a little puzzled by the variance decomposition generated by the Smets & Wouters 2007 mod file provided on Johannes’ github page here, and the results exhibited in the original paper. For example, the conditional variance decomposition at 10 quarters generated by the mod file for inflation and output are:

                ea      eb      eg     eqs      em   epinf      ew
pinf          4.83    0.75    0.77    1.41    8.62   42.58   41.05
y            39.07    7.77   10.75   14.14    8.68   10.54    9.05

But when I look at Figure 1 of Smets & Wouters 2007 (viewable here), the relative contributions look quite different. For example, the contribution of productivity shocks at 10 quarters are about 32% for GDP in the image compared to 39% in the table above. Similarly, price markup shocks contribute about 42% in the table above, but more like 32% in the image.

Am I generating the Conditional Variance Decomposition incorrectly? Or am I misunderstanding what S&W 2007 are showing in this image?

To be clear, I’m generating the variance decomposition by first running the estimation command with the mode taken from the mode_file and mh_repli=0 (so basically the estimation command is run unchanged), and then immediately specifying stoch_simul with the conditional_variance_decomposition=10 option:

estimation(optim=('MaxIter',200),datafile=usmodel_data,mode_file=usmodel_shock_decomp_mode,mode_compute=0,first_obs=1, presample=4,lik_init=2,prefilter=0,mh_replic=0,mh_nblocks=2,mh_jscale=0.20,mh_drop=0.2, nograph, nodiagnostic, tex);
stoch_simul(hp_filter = 1600, order = 1, irf=25, relative_irf, nograph, conditional_variance_decomposition=10) pinf y ;

Thank you in advance for the help!

Why are you using the HP filter? I am pretty sure they did not filter their growth rates.

Hi Johannes - thank you for the response, and apologies for the delay in responding.

Thank you for correcting me on the use of the HP-filter - that was indeed an oversight. However, removing it does not change the variance decomposition at all; the VD remains exactly as in the table I pasted in the original post. It did change the other theoretical moments, however.

To some degree this makes sense – my understanding is that the variance decomposition does not depend on the simulated output, but only on the parameters of the model and the variance of the shocks. So HP-filtering or not should not change the VD.

This led me to investigate the parameters and shock variances in the associated mode_file (called usmodel_shock_decomp_mode and found on the same github page that has the code). I was under the impression that this file contains the estimated mode values of the model. However, the values for the parameters and shocks in this file do not match the mean or mode reported by Smets & Wouters. For example, the value for the parameter crhoa (persistence of the productivity shock) is reported to be 0.95 in S&W, but the mode_file stores a value of 0.9826. All values similarly diverge, sometimes significantly.

I believe this to be the source of the disconnect between the paper and the code. Am I incorrect in assuming that the mode_file contains the final estimated values? Or am I missing something else?

As always, thank you for taking the time to respond!

The answer is contained in

I should update the repository to use the correct mode-file.

Ah, I see! Thank you!