# Log-exponential vs level form in Dynare

Dear Profs,

What’s the difference in using Log-exponential with level form in Dynare, particularly in high order? If I want to calculate the moments of endogenous variables after simulations, is there any change to the calculations? Could I apply the same method without any transformation?

Eg, care 1,

y = log(1);

model;

exp(x) = exp(y);

end

standard deviation of y = std(y);
%%%%%%%%%%%%%%%%%%%%%%%%%
care 2,

y =1;

model;

x = y;

end

standard deviation of y = std(y)?!

Hi,

I do not understand the question. If you write your model with all the variables inside exp functions, it means that all the variables are implicitly defined in logs. The moments reported by stoch_simul are for the logarithm of the variables. Obviously the variance, for instance, of the logarithm of a variable is not the same as the variance of the same variable. More generally, \mathbb V[\varphi (X)] is not equal to the \mathbb V[X]. But you can approximate the second variance from the first one, with a first order Taylor approximation around a deterministic point x^{\ast} (eg the deterministic steady state):

\mathbb V[\varphi (X)] \approx \mathbb V [\varphi(x^{\ast}) + \varphi'(x^{\ast})(X-x^{\ast})]

since x^{\ast} is deterministic, we have equivalently:

\mathbb V[\varphi (X)] \approx \varphi'(x^{\ast})^2 \mathbb V [X]

Hence dividing the variance of \varphi(X) by the square of the derivative of \varphi evaluated at x^{\star} (usually the steady state) you obtain an approximation of the variance of X.

Best,
Stéphane

P.S. Needless to say we also have: \mathbb V[\varphi(X)] \neq \varphi\left(\mathbb V [X]\right) in general.

1 Like

Thank you for your kind help. Now, how can I calculate the variance of variable X if using Log-exponential and level form respectively?

For the latter, it will be like, Var(X);

For the former, will it be like, Var(exp(X))? Sorry for my silly questions.

Hi,

I still do not understand your question. You are using the exponential transformation and want to compute the variance of the original variable, not the variance of \log X (which will be returned by stoch_simul)? You can use the approximation I described (note that simple algebra shows that if x^{\ast}=1, there is nothing to do and you can approximate the variance of X by the variance of \log X).

Note also that this exponential transform is not really necessary to have (all) the variables in logarithm. You could use instead the loglinear option (see the reference manual).

But in the first place, I do not understand why you want to log-linearise the model, and compute the moments of the variables in level (without logs) in the end…

Best,
Stéphane.

Dear Prof. Stéphane, right, that is exactly the question I’m confused with.
Sorry, my original model might not be log-linearised. How can I calculate its moments for log-linearised models? Thank you.

If your model is written in levels (without \exp) just add the loglinear option to the stoch_simul command.

Best,
Stéphane.

But if my model is not need to be log-linearised, how can I calculate its moments when applying log-exponential form instead of using loglinear option ? Thank you very much.

Sorry, I really do not understand your problem. Maybe someone else will.

Best,
Stéphane.