Behavioral New Keynesian Model

Dear all,
I’m new in Dynare and I’m currently trying to simulate a personal behavioral model.
The model is totally backward looking since I have written simply heuristics for any expectations.
The problem is that any utility function Z,V and U has always calculated equal 0.
This happens for each one, apart from V which is the only one that doesn’t include past values.
For this reason, I’m sure that the problem concernes past values of pi, g and a, but I don’t understand why Dynare works out, for example:
when g(-1) should be the value of g one period ago, and g(-2) should be a value of g two periods ago, and hence different values.
Moreover, it seems very strange to me that the weights of forecasters could be negative when they are calculated as a ratio between exponential functions.
I have attached my file.mod.
I hope in your answer and I thank you.
behavioral5.mod (7.12 KB)

You need to try to better understand your model and what is going on in it.

[code]U_ext_g=varrho*U_ext_g(-1)-(1-varrho)*(g(-1)-g(-2))^2; // 31. Utilità estrapolatori spesa pubblica [/code]
The term that is supposed to change utility is the last one. The first order Taylor approximation around the steady state is
(1-varrho)2(bar g -bar g)*(ghat1+ghat2)
The second bracket evaluates to 0 so there is no first order effect of g on utility. I presume this is what drives the results.

Dear jpfeifer,
thank you so much for your answer.
I agree with your point of view and what you describe is exactly what happens when I try to simulate my model.
According to me, the problem is that the behavioral model shouldn’t be linearized by Dynare in order to work effectively, but I suspect that it is impossible, it isn’t?
Trying to solve such a issue, I have added a very small constant in each utility function, in this way they are always different by zero. In your opinion, is it a good solution?
Anyway, the fact that Dynare linearizes equations with exponential function, cause me to sometimes obtain negative values for the weights of the forecasters, and a similar result is totally a nonsense.
So far, I haven’t been able to work out this problem.
I hope you will help me.
Thank you.
Best regards,
provabeh.mod (7.15 KB)

You need to understand the economic reasons behind this result. It is well known that first order approximations to the welfare function are not sufficient (see linear-quadratic control problems). But your problem seems to be deeper as even a second order approximation does not help.

@Elle211 did you manage to solve the issue?

I’m also working on a simple behavioral NK model and have the same issue - utilities go to 0 because of the Taylor approximation around steady state. Is there a way I can tell Dynare to calculate the quadratic expression?

Thanks a lot!

Best regards,