# Log-linearization

**URL:** <https://forum.dynare.org/t/log-linearization/1856>\
**Category:** Dynare help (legacy posts)\
**Created:** [21 February 2011 17:00 UTC](https://forum.dynare.org/t/log-linearization/1856 "2011-02-21T17:00:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John123](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@John123](https://forum.dynare.org/u/John123)\
**Post date:** [21 February 2011 17:00 UTC](https://forum.dynare.org/t/log-linearization/1856/1 "2011-02-21T17:00:46Z")

</div>

Hi all,

i want to log-linearize a model by Dynare. I calculated the steady state values by hand and wrote the model in terms of exp(log(variable)). Running the file generates always an error.  
It would be great if you could help me. thank you  
[model.mod](https://forum.dynare.org/uploads/default/original/1X/8a3424a8de426ea9174d7eca7061a3c54eec976c.mod) (2 KB)

---

<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:** [21 February 2011 18:07 UTC](https://forum.dynare.org/t/log-linearization/1856/2 "2011-02-21T18:07:05Z")

</div>

When you put

```auto
resid(1);
```

after your initval-command, Dynare shows you the residuals:

> [@](#):
>
> Residuals of the static equations:  
> Equation number 1 : 0  
> Equation number 2 : -3.3333  
> Equation number 3 : 3.4997  
> Equation number 4 : -0.01  
> Equation number 5 : -0.21583  
> Equation number 6 : -1  
> Equation number 7 : 1  
> Equation number 8 : -0.442  
> Equation number 9 : -2  
> Equation number 10 : -1.2867  
> Equation number 11 : 0.1  
> Equation number 12 : 0.5

Hence, your steady state is incorrect. The reason may be your try to get a loglinearization. Do not put variables as exp(log(x)). Rather, you have to use exp(x) because if in your original model you used x\_orig and now you use exp(x), it means that you performed a variable substitution: x=log(x\_orig).  
But when you use exp(log(x)), exp and log cancel and you are back to x=x\_orig. Note also that if a variable is already in logs in the original model (for example if you have shocks that are defined as percentage deviations from steady state), you do not replace them by their logs through putting exp() as you would then get log(log(x)).

---

<div class="post-metadata">

**Author:** ![John123](https://forum.dynare.org/letter_avatar_proxy/v4/letter/j/71e660/32.png) [@John123](https://forum.dynare.org/u/John123)\
**Post date:** [22 February 2011 07:48 UTC](https://forum.dynare.org/t/log-linearization/1856/3 "2011-02-22T07:48:47Z")

</div>

Thank you for your hints! I changed the model, as you told me. I also tried writing the error terms not in exp()-form.But i still get an error message, that the steady state values are wrong. i can’t understand that, because i calculated them by hand and the model is very easy. Do you have any idea, where there problem might be?

---

<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:** [22 February 2011 07:57 UTC](https://forum.dynare.org/t/log-linearization/1856/4 "2011-02-22T07:57:00Z")

</div>

Could you post the new mod-file? And did you consider that the steady state value of a variable transformed to be in logs has to be the log of the steady state value of the original variable? Moreover, by using the resid(1) command you can look at the residuals of the equations in order to get the steady state one by one. Try starting with the equations for the exogenous processes and work from there to the more complicated ones.
