# Smets and Wouters 2007 model: a problem?

Dear Johannes,
Dear all,
I carefully read the SW2007 model (paper + mod files provided by AER website, AER’s zip + mod file provided by Johannes’s GIT), and I have a little question about the code.

At the end of the consumption equation of the mod files (AER’s zip+GIT), we can see this:
(r - pinf(+1) + 0b) + b;

But in the paper (eq 2 of the SW2007 AER paper), the consumption equation ends with:
*(r - pinf(+1) + b);

So my question is simple: are the mod files from AER’s supplemental material or Johannes’ GIT are correct?
If yes, can u provide a clear explanation?
If not, can u provide a clear correction?

Same question for:
// Real value of the existing capital stock
pk = -r + pinf(+1) - 0b + (1/((1 - chabb/cgamma)/(csigma(1 + chabb/cgamma))))*b + …
that should be
pk = -r + pinf(+1) - b + …

Kind regards,
Jonathan

ps: tell me if it is a stupid question, but explain clearly why…

There will soon be an updated version of the mod-file on my github page. A preview of the explanation is:

However, I am not sure that results are unaffected by this.
Thank you to inform me when you update the file.
Kind regards,
Jonathan

Why do you think results may be affected?
A new and fully documented version for Dynare 4.5 is now available at
github.com/JohannesPfeifer/DSGE_mod/tree/master/Smets_Wouters_2007

I have run 2 estimations with same configuration and datasets
variance decomposition of risk premium shock are not the same.
I have done that last year, so maybe I have done a mistake about the correction of “(r - pinf(+1) + 0b) + b;” which I replaced by “*(r - pinf(+1) + b);” and similarly for the other occurrences of “b”.
I think u should try with a good correction and compare.

Another question: from where did u take the answer " The consumption Euler equation in the paper, equation (2), premultiplies the risk premium process \varepsilon_t^b, denoted by b in this code, by the coefficient c_3. In the code this prefactor is omitted by setting the coefficient to 1. As a consequence, b in this code actually is b:=c_3*\varepsilon_t^b. This rescaling also explains why the standard deviation of the risk premium shock in the AR(1)-process for b has a different standard deviation than reported in the paper. However, the results are unaffected by this "

?

Is it your response or does it comes from someone else ?

Kind regards,
Jonathan

No, this is my explanation. But Smets/Wouters already did something similar in their 2003 paper.

Dear Professor,
dear all,

for research purposes, especially aiming at variance decompositions, I did come across the SW2007 paper and existing mod files as well.
I also modified the mod file like @jonathanb did and found different results for the risk premium / preference shock compared to the estimation results using the mod file published by Prof. Pfeifer and SW.

Unfortunately, I am lacking explanation here since it is stated that the results should be unaffected…

Can anyone help me out with a short explanation please.
I don’t know which model to use for the purpose of variance decomposition.

Thank you and happy holidays!

Which variance decomposition are you relying on? In the estimation command? Or stoch_simul?

The one in the estimation command - moments_varendo.
stoch_simul seems not to produce such a deviation.

So, the mean variance decomposition show deviations, but not the variance decomposition at the mean.
It’s hard for me to find a good interpretation for this.

There may be an easy explanation: a bug in Dynare. See https://git.dynare.org/Dynare/dynare/merge_requests/1627
Could you please try the unstable version.

I will try the unstable version and give feedback.

Does this mean that the stoch_simul command is buggy?

No, the results from estimation for the variance_decomposition are buggy. stoch_simul is not affected.

Okay, thank you! So, I will use the results from stoch_simul for my research first and interpret them, and try the unstable version for moments_varendo.

That means, that there should be no huge difference in the risk premium shock and I could use the mod file published by you and SW

I ran a few tests with the unstable version now and the results look way more logicial than in the stable version.

Since I already computed many (time consuming) draws with the stable version, I am wondering if it is possible to compute moments_varendo for existing mode_file and load_mh_file with mh_replic=0 using the newest unstable version?

Yes, you can do that, but you need to delete the _draws*.mat-files in the metropolis-subfolder

Thanks a lot, Professor - that really helps me and will work for my purposes.

The _draws*.mat-files size then shrinks from ~250 MB to ~15 MB.
What kind of information is stored in them?

Those files stored the decision rules for the parameter subdraws.