Troubles with dynare 4.0

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.

Troubles with dynare 4.0

Postby cicciorasta » Sun Jul 11, 2010 3:53 pm

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
cicciorasta
 
Posts: 5
Joined: Thu Sep 27, 2007 10:13 am

Re: Troubles with dynare 4.0

Postby jpfeifer » Mon Jul 12, 2010 5:59 am

You could use your steady state file with the code provided in the following topic: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=1834&p=5055&hilit=steadystate.m#p5055
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.
------------
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: Troubles with dynare 4.0

Postby cicciorasta » Mon Jul 12, 2010 8:36 am

Thank you, jpfeifer.
I have tried your suggestion and the code works great.
Francesco
cicciorasta
 
Posts: 5
Joined: Thu Sep 27, 2007 10:13 am

Re: Troubles with dynare 4.0

Postby cicciorasta » Mon Jul 12, 2010 10:08 am

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
cicciorasta
 
Posts: 5
Joined: Thu Sep 27, 2007 10:13 am

Re: Troubles with dynare 4.0

Postby jpfeifer » Mon Jul 12, 2010 6:58 pm

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.
------------
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: Troubles with dynare 4.0

Postby cicciorasta » Mon Jul 12, 2010 8:54 pm

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
cicciorasta
 
Posts: 5
Joined: Thu Sep 27, 2007 10:13 am

Re: Troubles with dynare 4.0

Postby jpfeifer » Tue Jul 13, 2010 6:00 am

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

Code: Select all
M_.params(15)= rho;
------------
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


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 9 guests