# SmetsWouters2003 model code

**URL:** https://forum.dynare.org/t/smetswouters2003-model-code/2218
**Category:** Dynare contributions and examples
**Created:** [27 October 2011 16:49 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218 "2011-10-27T16:49:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mukhon](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@mukhon](https://forum.dynare.org/u/mukhon)
#### Post date: [27 October 2011 16:49 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/1 "2011-10-27T16:49:57Z")

</div>

Hi, all!

I am tring to replicate SmetsWouters 2003 model. Please see the .mod file, filtered AWM statistics and the article. Now i get IRFs for all real endogenous variables on all shocks almost exactly as in the article. But all getting IRF’s of inflation, short-time rate and capital return rate are less several times than in the article.  
Can anybody help me, where are mistakes?  
Thank you very much!

---

<div class="post-metadata">

### Author: ![glucke](https://forum.dynare.org/letter_avatar_proxy/v4/letter/g/73ab20/32.png) [@glucke](https://forum.dynare.org/u/glucke)
#### Post date: [28 October 2011 12:51 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/2 "2011-10-28T12:51:37Z")

</div>

It’s possible that you use a different IRF. You use “stoch\_simul” command which means classical IRF. SW2003 makes Bayesian IRF. They could be different.  
If it doesn’t help, could you post your Bayesian IRF? Calculation of Bayesian IRF require time.  
PS It would be better to estimate model with higher mh\_replic. SW2003 have 100 000 posterior sample which means mh\_replic=200 000 at least.

---

<div class="post-metadata">

### Author: ![mukhon](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@mukhon](https://forum.dynare.org/u/mukhon)
#### Post date: [1 November 2011 10:50 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/3 "2011-11-01T10:50:51Z")

</div>

Thank you for your fast answer!  
My estimated parametres are different from the article’s ones. So, not surprising, bayesian IRFs are more different (worse) from article’s ones than IRFs simulated with parametrized model.  
Causes of bad estimation parametres are may be from the mistakes in model code or the statistic wasn’t exactly filtered as done by Smets-Wouters.  
The estimation command was changed according to the article and your advice.

```auto
estimation(datafile=StatEU, xls_sheet=StatEU, mode_compute=6, mode_check, mh_replic=200000);
estimation(datafile=StatEU, xls_sheet=StatEU, mode_compute=0, mode_file=smetswouters_mode, mh_replic=10000, bayesian_irf, irf=20, load_mh_file) Pi W K Q I C R R_k L E Y;
```

Please see attached results (please get IRFs from oo\_.PosteriorIRF.Dsge).

---

<div class="post-metadata">

### Author: ![np2333](https://forum.dynare.org/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@np2333](https://forum.dynare.org/u/np2333)
#### Post date: [4 November 2014 01:30 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/4 "2014-11-04T01:30:41Z")

</div>

can someone tell me where I an get the data used in Smets and Wouters (2003). Thanks

---

<div class="post-metadata">

### Author: ![RMB](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b19c9b/32.png) [@RMB](https://forum.dynare.org/u/RMB)
#### Post date: [21 May 2015 18:45 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/5 "2015-05-21T18:45:52Z")

</div>

Do you have the code for Smets & Wouters 2003?  
I am not understanding why I have y as variable in monetary policy rules, but, at the variables block, the authors did not put it there.

Thanks

---

<div class="post-metadata">

### Author: ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)
#### Post date: [23 May 2015 10:52 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/6 "2015-05-23T10:52:17Z")

</div>

See [[Dynare Code for Smets Wouters 2003 desperately needed](https://forum.dynare.org/t/dynare-code-for-smets-wouters-2003-desperately-needed/4709/1))

---

<div class="post-metadata">

### Author: ![RMB](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b19c9b/32.png) [@RMB](https://forum.dynare.org/u/RMB)
#### Post date: [26 May 2015 14:02 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/7 "2015-05-26T14:02:53Z")

</div>

Thank you!

---

<div class="post-metadata">

### Author: ![RMB](https://forum.dynare.org/letter_avatar_proxy/v4/letter/r/b19c9b/32.png) [@RMB](https://forum.dynare.org/u/RMB)
#### Post date: [27 June 2015 14:27 UTC](https://forum.dynare.org/t/smetswouters2003-model-code/2218/8 "2015-06-27T14:27:55Z")

</div>

Hi,

I did some changes in Viegi’s script ([nviegi.net/teaching/master/sw.zip](http://www.nviegi.net/teaching/master/sw.zip))and I’m getting success. However, I wonder how I can improve the model, let me explain: I would like to add a new sector, maybe the government, but this have to be in a simple way. I am thinking put a government good in consumer’s preferences and put taxes too. Anyone have some suggestions to improve SW for me?
