Log-linearization in Dynare

Hi everyone,

I would like to get impulse response functions that are interpretable in term of percentage deviations using Dynare.

To get a loglinearized version, we can, according to Prof. Pfeifer in one of older the posts, either:

  1. Do the exp() substitution of every variable;
  2. Invoke the loglinear option;
  3. Define the log-levels as auxiliary variables.

The capital accumulation function has general form:

k_t = (1 - \delta_k) k_{t - 1} + i_t

Does exp() substitution imply the following:

\mathrm{exp}(k_t) = (1 - \delta_k) \mathrm{exp}(k_{t - 1}) + \mathrm{exp}(i_t)

Which lead to getting impulse response functions that are interpretable in term of percentage deviations or am I getting it wrong?

Yes, that is correct. But that implies that you substitute everywhere for k and i. It usually easier to append

log_y=log(y)

or, starting in Dynare 6, you can use var(log) k i to automatically append LOG_y and LOG_k.

1 Like

Thank you so much Prof. Pfeifer for your answer. I have some additional questions if you don’t mind:

  1. Do we mean by append here, log substitution similar to exp substitution (instead of log_y = log_y - log_y_ss)? and in what way is it easier?
  2. After the exp or log substitution, should we let stoch_simul in its default settings?
  3. In case we let the model in its non-linear form without any form of substitution, will invoking the loglinear option in stoch_simul be enough to get irfs in term of percentage deviations? if so, in what way the substitution techniques are better?

Please have a look at

1 Like

Thank you so much Prof. Pfeifer for the detailed explanation. I’m forever grateful.

Good afternoon,
I tried to use option 3 in the post cited above to have my IRFS in deviations from the steady state for some variables. However, I am doing something wrong and the code is not running anymore. Could anyone help me, please? This is the code:
AspirationsHabitsUBI_dif_shock.mod (3.9 KB)

The resid(1) syntax is now just resid;:
AspirationsHabitsUBI_dif_shock.mod (3.9 KB)

The steady state in your model does not make sense. The interest rate is negative.

AspirationsHabitsUBI_dif_shock.mod (3.9 KB)
I saw that later… Here is the previous version of the same code before I tried to introduce log-variables. It runs and r>0 (although the value for it is implausibly high).
Still, may you see if you identify what I did wrong when trying to get the transformed variables to plot them? This should not affect the computed ss values.

Dear Johannes Pfeifer,
I rechecked the codes. It’s strange, but it looks like the introduction of the auxiliar log-variables make the code unable to find the steady state… I upload here the running code and the “same” code once I introduced log_y. I tried changing the initial values by those found as steady state values in the running code, but it makes no difference. How could it be? Any tip is welcome. Thank you so much.
AspirationsHabitsUBI_dif_shock.mod (3.6 KB)
AspirationsHabitsUBI_dif_shocktrylogs.mod (3.7 KB)

You should go for an analytical steady state. If you use the var(log) y; statement to automatically append the logged value, Dynare will find a different steady state:
AspirationsHabitsUBI_dif_shock.mod (3.6 KB)