# Will linearize and log linearized irfs the same

Hello Everyone,

Just a very general question.

I found the irfs from my non-linearized model (for which, I directly put into the model section, without exp(), nor loglinear option, and in this command::stoch_simul(order=1, periods=2000, irf=100) ), is different from the irfs from the hand log-linearized above model (for which, I put after the model (linear); command, and with the same: :stoch_simul(order=1, periods=2000, irf=100) )

is it possible that the irfs from the linearized and log-linearized not the same, or I made a mistake somewhere, these irfs should be the same.

P.s. there are variable whose steadystate value is 0. And I am not sure I do this correct, in log linearizing model, I use the following linearization for 0 steady-state variables:

a_t = a^hat_t

If I understand your description correctly, you are comparing non-logged levels in the nonlinear model to the logged version in the linearized model. Those IRFs will obviously not be the same, because one is in percent, the other not.

1 Like

Yes, that’s what I mean.

I know their values of change (the values in the vertical axis in the irf graphs) are different (one is in percentage and the other is in levels) , but will the shape of the irfs the same, I tried the simple RBC model and found though their values are different, their shapes look the same.

The difference should be that the loglinearized IRFs are scaled by 1/(steady state value). So the overall shape must be the same.

Thanks a lot for the reply. I found some vairables look the same in linearized and log-linearized model, but some are not.

Will 0-steady-state-value variables affect the irfs?

When I log linearize the model by hand, I use the following log linearization for variables whose steady state are 0 :

x_t = x^_t

where x_tt is the level of the variable, x^_t is the percentage deviation from steady state of x.

is this correct? How should I log linearized the variable whose steady state is 0?

Thanks a lot.

Remember you are log linearizing entire functions, not variables. I think you should log linearize all functions the same way.

1 Like

Oh, thanks a lot for the reminding. I am not sure I understand you correct. I didn’t take logs for the equations first and then approximate the whole equations…

I log linearized by replacing the non-0-steady-state varaibles using the following approximation:

x_t = x_bar *(1+ x^hat_t)

or

x_t = x_bar * exp(x^hat_t)

where, x_t is the vairable, x_bar is the steady state of the variable, x^hat_t is the percentage deviation of x_t to x_bar.

I tested some equations, and found this approach produce the same result as taking logs of the equations first and then approximate the whole equations.

And becuase I cannot get percentage deviation for 0-steady-state variables, (x_t-0)/0 would be infinity, so, I just use level deviation for 0-steady-state variables, that

x_t = x^hat_t

while here, x^hat_t is the level deviation of x_t to x_bar, where x_bar =0.

not

x_t = x_bar *(1+ x^hat_t)

But I am not sure this inconsistance will cause difference in the irfs from linearized and log linearized equation.

Not sure I understand this

Is this your own developed technique? I think you should not take logs first. Use a standard log-linearization technique like Uhlig’s. Example here. You don’t need to take logs first.

If I may ask, why are you take logs first of your equations?

Thanks a lot for the clarification. Sorry for the confusion, I thought you mean take log first. Yes, I am using your approach for hand log linearization. But the irfs from my hand linearized model is different from the irfs from the non-linearized model. Not sure where goes wrong.

For taking logs, I saw Eric sims’s notes doing so. e.g:

Maybe try to simplify your model as much as possible where you get the same results, and then add features gradually to see where the problem occurs.

Thanks. will try this out.

There are different ways to log-linearize at first order, but they should all results in the same outcome. @Olivia If you are unsure how to do this, then you should not be linearizing by hand. It’s too error-prone. Let the compute do it. See also Why do we log linearize a model by hand?

Regarding steady state 0: in this case, you do not log-linearize, you linearize. Thus, the IRFs should be identical to the nonlinear version at first order.

Thanks a lot for the reply.

Sorry to be repetitive, Just wanna double check with you,

For

Does it mean

1. if I use exp() for log linearization, I will not use exp() on 0-steady-state-value variables, but on other non-0-steady-state-value variables which I want to measure in percentage?

2. If I want to hand log linearize the whole model by hand, I will leave 0-steady-state-value variables as x_t itself or replace it by x^hat_t (in fact they are the same?), and not replace it by x_ss * exp(x^hat_t) as other non-0-steady-state-value variables do?

where x_t is the variable itself,
x_ss is the steady state of the variable,
1. Exactly. But I would not recommend doing `exp`-substitutions. Rather use auxiliary equations. See Question about understanding irfs in dynare - #4 by jpfeifer
2. How you would do the replace. You would be multiplying be `x_ss=0`.