# Basic question about transformation to logs model

**URL:** <https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752>\
**Category:** Stochastic simulations\
**Created:** [22 August 2021 04:47 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752 "2021-08-22T04:47:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dsge\_modeling](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@dsge\_modeling](https://forum.dynare.org/u/dsge_modeling)\
**Post date:** [22 August 2021 04:47 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752/1 "2021-08-22T04:47:48Z")

</div>

I want to have relative irfs and percentage std. devs. I already have my model in levels, but since it’s a medium scale model (~70 variables), I want to avoid manually setting the `x` to `exp(x)` substitution for each variable in the .mod file. Then I just thought that I could create auxiliary variables that represent the logs in this way:

```auto
var x y z 
% then the logs
lx ly lz
;

model;
% Regular levels model equations
eq 1
eq 2
eq 3
% Assigning the logs
lx = exp(x);
ly = exp(y);
lz = exp(z);
end;

```

Therefore for percentage second moments and relative irfs I’d only work with `lx`, `ly`, `lz` .Is that correct?

---

<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:** [26 August 2021 13:04 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752/2 "2021-08-26T13:04:37Z")

</div>

No, use logs. See

> [@Question about understanding irfs in dynare](https://forum.dynare.org/t/question-about-understanding-irfs-in-dynare/10622/4):
>
> To be more precise: it depends on how the variables in your model are measured. As @stepan-a says, Dynare conducts a linearization. If you for example have a nonlinear model and your model variable is simply the level of output, the IRF will measure the difference between the variable and its steady state (or its mean at higher order). This is the case with [https://github.com/DynareTeam/dynare/blob/master/examples/example1.mod](https://github.com/DynareTeam/dynare/blob/master/examples/example1.mod) In contrast, if your model variable already measures percentage…

---

<div class="post-metadata">

**Author:** ![dsge\_modeling](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@dsge\_modeling](https://forum.dynare.org/u/dsge_modeling)\
**Post date:** [26 August 2021 22:08 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752/3 "2021-08-26T22:08:29Z")

</div>

Thanks! Also I was checking the Guide to Specifying Observation Equations, I can interpret that it don’t matter if I only use the exp() substitution in a subset of the equations, e.g. if I’m only interested in consumption relative irfs, only transform consumption to logs (with the exp()).

Also, regarding variables that are rates (e.g. nominal interest or unemployment rate), it’s not necessary to perform the transformation since as rates, percentage deviations would have kind odd interpretation, is that correct?

---

<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:** [30 August 2021 07:22 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752/4 "2021-08-30T07:22:21Z")

</div>

1. As I wrote, I would not do a substitution at all, but rather append an auxiliary equation like

```auto
log_c=log(c);

```

1. Yes, usually we do not log interest rates. The only exception is when turning gross into net interest rates.

---

<div class="post-metadata">

**Author:** ![dsge\_modeling](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@dsge\_modeling](https://forum.dynare.org/u/dsge_modeling)\
**Post date:** [30 August 2021 22:47 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752/5 "2021-08-30T22:47:10Z")

</div>

Thanks!

1. Just to make sure I didn’t mess up, having converted only a few non-ratio variables to exp() (I mean not as I specified in the first post, but substituting every appearance of `x` in the levels model for `exp(x)`) transform and other just left as levels do not affect the model, right?

---

<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:** [31 August 2021 06:45 UTC](https://forum.dynare.org/t/basic-question-about-transformation-to-logs-model/18752/6 "2021-08-31T06:45:51Z")

</div>

Yes, selectively performing an exp()-substitution for some variables is correct as long as you consistently replace all occurrences.
