Page 1 of 1

Smets&Wouters error

PostPosted: Tue Apr 17, 2012 2:12 pm
by sashe86
Hi there,

I am trying to run the Smets and Wouters code which I downloaded from this site.

When i run the model, I get the following error;

Starting Dynare (version 4.2.5).
Starting preprocessing of the model file ...
ERROR: usmodel.mod:80.14: syntax error, unexpected ';', expecting EQUAL

??? Error using ==> dynare at 114
DYNARE: preprocessing failed

I've had a look through the code, but I'm not sure what needed to be amended?

Any ideas?

S

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 3:28 pm
by kyri82
Check line 80, where the command ends. Or better, check if actually the command in line 79 ends with a ";"

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 3:37 pm
by sashe86
Hi kyri82,

Yes, at line 80, there is a ';' - I have removed the ';' and re-ran the model and then get this error:

Starting Dynare (version 4.2.5).
Starting preprocessing of the model file ...
ERROR: usmodel.mod:84.8: syntax error, unexpected INT_NUMBER, expecting EQUAL

When I change it to an equal (which doesn't really make sense to me), I get this error:

tarting Dynare (version 4.2.5).
Starting preprocessing of the model file ...
ERROR: usmodel.mod:84.28: syntax error, unexpected EQUAL

??? Error using ==> dynare at 114
DYNARE: preprocessing failed

So, I wonder what it could be?

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 3:39 pm
by kyri82
Can you send me the file? The original one, with the first error message.

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 3:50 pm
by sashe86
The .mod file I'm using is attached.

Thanks for the help!

S

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 3:59 pm
by kyri82
What does this command do? #usmodel_stst;
And why does it appear in the model block?

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 4:49 pm
by bkjecn
Any command in the model section of the form

#varname = expression ;

is a model local variable. Those are documented here: http://www.dynare.org/manual/index_15.h ... eclaration

Just delete that line since it isn't of the correct form in your file and then change the inv_gamma_pdf priors to inv_gamma2_pdf priors. The problem is that you are giving it values that it cannot use to solve for the hyperparameters. I did it in the attached file and it worked. You will next need a file for the data named usmodel_data. You didn't post that so I am not sure if you have it or from where to get it. It might be on whichever site you used to download the mod file.

Re: Smets&Wouters error

PostPosted: Tue Apr 17, 2012 5:01 pm
by sashe86
@bkjecn,

Thanks, that solved the problem, really appreciate your help. Same to you @kyri82.

S

Re: Smets&Wouters error

PostPosted: Thu Apr 19, 2012 6:42 am
by jpfeifer
The original Smets/Wouters code was written for Dynare 3. What #usmodel_stst did is call a Matlab function that computed some of the parameters. You should not simply delete it. Note that there is a functioning version of the Smets/Wouters Model for Dynare 4 in the forum: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2588&p=5805#p5805

Re: Smets&Wouters error

PostPosted: Thu Apr 26, 2012 5:02 pm
by sashe86
jpfeifer wrote:The original Smets/Wouters code was written for Dynare 3. What #usmodel_stst did is call a Matlab function that computed some of the parameters. You should not simply delete it. Note that there is a functioning version of the Smets/Wouters Model for Dynare 4 in the forum: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2588&p=5805#p5805



Hi jpfeifer ,

Just seeing your response now. I agree. It doesn't seem sensible to simple delete a line of code. I had a look at the functioning version of the SW model for Dynare 4 which you are referring to. Unfortunately, I seem to be getting an error when I run it:


Starting Dynare (version 4.2.5).
Starting preprocessing of the model file ...
ERROR: usmodel_shock_decomp.mod:186.21-26: syntax error, unexpected NAME, expecting PARAMETER_SET

??? Error using ==> dynare at 114
DYNARE: preprocessing failed

When I remove the line at 186 relating to the shock composition, I then get this error:

You did not declare endogenous variables after the estimation command.
This version of Dynare cannot estimate non linearized models!
Set "order" equal to 1.

??? Error using ==> inverse_gamma_specification at 121
inverse_gamma_specification:: Failed in solving for the hyperparameters!

Error in ==> set_prior at 224
[bayestopt_.p6(k(i)),bayestopt_.p7(k(i))] = ...

Error in ==> dynare_estimation_init at 124
[xparam1,estim_params_,bayestopt_,lb,ub,M_] = set_prior(estim_params_,M_,options_);

Error in ==> dynare_estimation_1 at 37
[data,rawdata,xparam1] = dynare_estimation_init(var_list_);

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> usmodel_shock_decomp at 412
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin('base',fname) ;

Re: Smets&Wouters error

PostPosted: Thu Apr 26, 2012 8:28 pm
by jpfeifer