Smets/Wouters (2007) in Dynare 4.2.5

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Wed May 27, 2015 4:46 pm

You cannot use Dynare 4.2.5 with newer Matlab version due to changes in Matlab'r random number generator. Please use the current Dynare stable version (4.4.3 at the time of this writing.)
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby www3 » Tue Dec 29, 2015 2:59 pm

Hi,

I'm trying to compare the 2007 Smets Wouters model with some other models I created. I downloaded the model from the original post. I have two quick questions. What is the date on the data, and how are they transformed. Is it an exact copy of the paper? If so could you tell me the source you got the information from. I tried to get it from FRED but am unable to find the data the matches close enough for me to be satisfied. Thanks,

Cameron
www3
 
Posts: 1
Joined: Mon Dec 28, 2015 3:32 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Tue Dec 29, 2015 3:07 pm

The most current file is now kept at https://github.com/JohannesPfeifer/DSGE_mod/tree/master/Smets_Wouters_2007
The data are taken directly from the Smets/Wouters (2007) replication files at the AER. Their Appendix also describes the transformations, see https://www.aeaweb.org/articles.php?doi=10.1257/aer.97.3.586
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby mjfourier » Thu Feb 25, 2016 7:38 pm

jpfeifer wrote:The most current file is now kept at https://github.com/JohannesPfeifer/DSGE_mod/tree/master/Smets_Wouters_2007
The data are taken directly from the Smets/Wouters (2007) replication files at the AER. Their Appendix also describes the transformations, see https://www.aeaweb.org/articles.php?doi=10.1257/aer.97.3.586


Hi, I am using Dynare 4.4.3, but when I take the code directly from your website, the following message shows up:

You did not declare endogenous variables after the estimation/calib_smoother command.

Error using load
Unable to read MAT-file
C:\Users\admsop\Dropbox\usmodel_shock_decomp_mode.mat: not a
binary MAT-file.
Try LOAD -ASCII to read as text.
Error in dynare_estimation_init (line 125)
mode_file = load(options_.mode_file);
Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_,
estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname,
[], M_, options_, oo_, estim_params_,
bayestopt_);
Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);
Error in codedi (line 505)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin('base',fname) ;


I don't understand what might be wrong, I just downloaded the files and ran them using the lastest stable Dynare version.

Thanks in advance for any guidance!
mjfourier
 
Posts: 5
Joined: Mon Feb 15, 2016 7:15 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Fri Feb 26, 2016 7:40 am

Did you put the
Code: Select all
usmodel_shock_decomp_mode.mat

in the same folder? There seems to be a text file with the same name already there.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby mjfourier » Fri Feb 26, 2016 4:27 pm

That was it, thanks :)
mjfourier
 
Posts: 5
Joined: Mon Feb 15, 2016 7:15 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby mjfourier » Sun Feb 28, 2016 8:03 pm

Hello Mr Pfeifer,

1. I am trying to do something similar to Figure 5 of the original paper (Actual and model-based cross-correlation function between output and inflation). After running your code, try the following in my command window

Code: Select all
crossmod=xcorr(y,pinf)
crossdata=xcorr(dy,pinfobs)


(then I would take those two series and plot them, but I receive the following error:

Undefined function or variable 'y'.

Nevertheless, y is one of my declared endogenous variables. Could you help me know what am I missing?

2. I use

Code: Select all
stoch_simul(irf=20, conditional_variance_decomposition=[1,2,4 10, 40,100]) dy dc dinve robs pinfobs dw labobs ;


and I want ultimately to get a graph of the forecast error variance decomposition like the one in the paper (figure 1), and I understand that is what conditional_variance_decomposition=[1,2,4 10, 40,100] is for, but I am not sure where the output of this is stored, or how to insert a command to get a plot (if that is possible).

Thank you very much in advance!
mjfourier
 
Posts: 5
Joined: Mon Feb 15, 2016 7:15 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Mon Feb 29, 2016 9:23 am

1. The code does not simulate data from the model, so you cannot do what your are trying. There are two ways: either add a periods statement to the stoch_simul command you are using or compute the correlations based on the covariances stored in
Code: Select all
oo_.autocorr

For details, see http://www.dynare.org/manual/index_26.html#oo_005f_002eautocorr
Regarding data moments, you have to compute them from your dataset. Do no rely on simulated moments from Dynare after stoch_simul. dy and pinfobs will not be from the loaded dataset, but simulated from the model.
2. See http://www.dynare.org/manual/index_26.html#oo_005f_002econditional_005fvariance_005fdecomposition. You would have to extract the required numbers and then plot them using Matlab's functions
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby Brasidas » Tue Nov 15, 2016 4:47 pm

Dear all,

I have searched on the forum but haven't quite found an answer.
I have run the Smets-Wouters model from Johannes' Gibhub as well as this forum (they're essentially the same) and
1) If I perform 'steady' or 'check' the file crashes as the steady state contains NaN of Inf. It also adds the warning that some of the parameters have no value. Without these checks the model solves but these errors are clearly undesirable.
2) If I run the identification command I then get the warning that the rank of J (moments) is deficient as several parameters are pairwise collinear.

Are these problems well known and just ignored?
Any help would be greatly appreciated.
Brasidas
 
Posts: 5
Joined: Thu Mar 20, 2014 7:00 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Tue Nov 15, 2016 9:05 pm

1) The reason is that Smets/Wouters did not provide a fully calibrated model before calling the estimation command. To fix this, simply add
Code: Select all
constepinf=0.7;
constebeta=0.7420;
ctrend=0.3982;

before the model-block. I just updated the version for Dynare 4.5 at https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Smets_Wouters_2007/Smets_Wouters_2007_45.mod

2) I have to investigate this more deeply. Iskrev does not note any issues here, so this might be a problem with Dynare.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby Brasidas » Wed Nov 16, 2016 10:09 am

Thank you. Regarding (1) it was just as I'd thought, but wanted to check that there wasn't something subtle going on.
Brasidas
 
Posts: 5
Joined: Thu Mar 20, 2014 7:00 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Tue Dec 13, 2016 3:35 pm

Regarding point 2) At the prior mean, [cmap,crhopinf] and [cmaw,crhow] are pairwise collinear. Thus, running identification at the prior mean will return a warning. But this is only a local issue. These parameters are only indistinguishable at the prior mean, but not at different points, like the mode. I have added this information to the mod-file.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby brasidas1 » Thu Dec 15, 2016 2:41 pm

That makes sense. Thank you for looking into this.
brasidas1
 
Posts: 5
Joined: Fri May 16, 2014 8:20 am

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby David Gutkovsky » Wed May 24, 2017 2:27 am

Hi jpfeifer,

I'm kind of new to Dynare and I don't have much experience with complex macro models like SW07. My professor asked me to write/find the Dynare code for SW07. I found this forum and the code worked perfectly. However, my professor wants to use a conventional parameterization (let's say alpha=1/3) and doesn't want to use these prior and posterior values and distribution of parameters.

I wrote the code based on yours and I took out the "estimation" part of the code. However, it doesn't work, giving the following error: "The Jacobian matrix evaluated at the steady state contains elements that are not real or are infinite".

What is exactly the problem? Is it possible to only use conventional parameterization (like in my code)? Do I just need to try some numbers to make it work?

Thank you for your time and help!

David.
Attachments
SW07_model.mod
(4.31 KiB) Downloaded 91 times
David Gutkovsky
 
Posts: 2
Joined: Tue May 23, 2017 8:43 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Thu May 25, 2017 5:39 pm

Use F9 in Matlab to execute the parameter definitions before the model block.You will see that same ratios that should be positive become negative so that you get complex values after that.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

PreviousNext

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests