# Troubles with dynare 4.0

**URL:** <https://forum.dynare.org/t/troubles-with-dynare-4-0/1549>\
**Category:** Dynare help (legacy posts)\
**Created:** [11 July 2010 15:53 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549 "2010-07-11T15:53:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cicciorasta](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@cicciorasta](https://forum.dynare.org/u/cicciorasta)\
**Post date:** [11 July 2010 15:53 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/1 "2010-07-11T15:53:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [12 July 2010 05:59 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/2 "2010-07-12T05:59:37Z")

</div>

You could use your steady state file with the code provided in the following topic: [[Steady state file](https://forum.dynare.org/t/steady-state-file/782/8))  
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.

---

<div class="post-metadata">

**Author:** ![cicciorasta](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@cicciorasta](https://forum.dynare.org/u/cicciorasta)\
**Post date:** [12 July 2010 08:36 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/3 "2010-07-12T08:36:37Z")

</div>

Thank you, jpfeifer.  
I have tried your suggestion and the code works great.  
Francesco

---

<div class="post-metadata">

**Author:** ![cicciorasta](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@cicciorasta](https://forum.dynare.org/u/cicciorasta)\
**Post date:** [12 July 2010 10:08 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/4 "2010-07-12T10:08:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [12 July 2010 18:58 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/5 "2010-07-12T18:58:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cicciorasta](https://forum.dynare.org/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@cicciorasta](https://forum.dynare.org/u/cicciorasta)\
**Post date:** [12 July 2010 20:54 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/6 "2010-07-12T20:54:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [13 July 2010 06:00 UTC](https://forum.dynare.org/t/troubles-with-dynare-4-0/1549/7 "2010-07-13T06:00:35Z")

</div>

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

```auto

```
