Hi,

I am trying to run a mod file for dynare 3 into dynare 4 and I got some problem. To be specific

I need to call for parameters values that I get from the steady-state. Since we performe an estimation

by keeping fixed the steady-state value of one endogenous variable (hours worked), I need to adjust

one parameter in order to guarantee that all the equations are satisfied. So, we fixed this problem with

dynare 3 by writing an external code for the steady-state in which we find the values of all the ondegouns variables

and the parameter I need to adjust each iteration (but with a different name). In the same code I had a line in which the parameter

is saved in a mat file. Then, I wrote another matlab code in which the mat file is called. Then, the parameter value is

feed into the mod file by adding a line at the beginning of the model’s declaration using the following syntax

model;

//Parameters defined by the SS

#bu_asp08h_stst;

where bu_asp08h_stst is the matlab code containing the value of the parameter.

Apparently, this command does not work with dynare4, I have got the following message;

bu_asp08h.mod:46.15: syntax error, unexpected ‘;’, expecting EQUAL

do you know how to fix this problem? I have tryied @#include but I get again en error

thanks in advance

Francesco

You could use your steady state file with the code provided in the following topic: [Steady state file)

If you change or compute parameter values in the file created with the steadystate.m file, Dynare takes this recomputed value in each estimation iteration.

Thank you, jpfeifer.

I have tried your suggestion and the code works great.

Francesco

Just another think, jpfeifer

instead of using your code steadystate, I have added to my steadystate code (which performs a non-linear equation solving), the following lines

at the end of the code:

for iter = 1:length(M_.params)

eval( ‘M_.params(’ num2str(iter) ') = ’ M_.param_names(iter, ‘;’ ]);

end

In this way the parameters I calibrate with the steadystate should be updated each iterations

while the other should be the one obtained in the estiamation step. Isn’t it?

thank you in advance

Francesco

All the steadystate.m file does is to load all parameters (and variable values) at the beginning and write them back at the end. As long as you do not change them in the code in between (your iterations I guess), Dynare can estimate them, because the values set by Dynare are simply passed on without changes. The way you suggest should also work, because it seems to do the same.

Hi jpfeifer,

I checked it works… thank you. Just one think, which is probably obvious.

I realize that using loops to assign parameters values in the steady-state

makes the MCMC computation very slow. So, I have changed again this

code substituiting the loop with a list like this

eval( 'M_.params(15) = ’ M_.param_names(15, ‘;’ ]);

eval( 'M_.params(16) = ’ M_.param_names(16, ‘;’ ]);

and the computation is dramatically faster thant using the loop. I think this

is a limitation of Matlab

thanks a lot again

Francesco

Hi,

that’s possible if you only change those two parameters and that they are always in the fields 15 and 16. However, in this case, you might even want to speed it up by avoiding the eval-step. For example, if your parameter is named rho (the name that is in M_.params(15) ), could directly use