Smets&Wouters error

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

1 Like

Check line 80, where the command ends. Or better, check if actually the command in line 79 ends with a “;”

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?

Can you send me the file? The original one, with the first error message.

The .mod file I’m using is attached.

Thanks for the help!

S
usmodel.mod (12 KB)

What does this command do? #usmodel_stst;
And why does it appear in the model block?

Any command in the model section of the form

#varname = expression ;

is a model local variable. Those are documented here: 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.
usmodel.mod (12 KB)

@bkjecn,

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

S

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: [Syntax shock_decomposition)

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) ;

See here: [Smets/Wouters (2007) in Dynare 4.2.5)