New Keynesian model with four types of expectations

I’m trying to implement a New Keynesian model with heterogenous expectations ( … 27&EXT=pdf) in Dynare.

However, I get some error messages and I do not know how to correct them. I am not even sure whether Dynare can handle this type of models.

Please find attached my code. I am looking forward to your responses
Assenza.mod (4.15 KB)

I don’t understand what you are doing. The first part of the model is linearized, but then you have a bunch of nonlinear equations? How does that fit together? Also, you are using abs(), which introduces a discontinuity that stoch_simul cannot handle.

The nonlinear equations generate business cycle fluctuations in the standard New Keynesian framework (with linearized equations). It is not necessary to add stochastic shocks in order to get these fluctuations.
However, if I use a deterministic version with simul (instead of stoch_simul), I still get the same error message:

[code]An infinite element was encountered when trying to solve equation(s) 56
with respect to the variable(s): pi.
The values of the endogenous variables when the problem was encountered were:
y -0.6977
pi 3.233
i 2
Ey -0.2014
Epi 1.901
pilg 3.72
pilglg 3.98
ylg -0.05
ylglg 0.28
cumpi 10.93
cumy -0.4677
n1pi 0
n2pi 0.1
n3pi 0.4
n4pi 0.5
n1y 0.15
n2y 0.2
n3y 0.5
n4y 0.15
t 3
upi1 55.16
upi2 72.2
upi3 86.88
upi4 77.28
uy1 59.84
uy2 65.72
uy3 81.65
uy4 74.15
pi1_e 2.418
pi2_e 3.616
pi3_e 3.382
pi4_e 3.525
y1_e -0.0325
y2_e -0.182
y3_e -0.479
y4_e -0.355
piav 3.644
yav -0.1559
pi1_elg 2.418
pi2_elg 3.616
pi3_elg 3.382
pi4_elg 3.525
y1_elg -0.0325
y2_elg -0.182
y3_elg -0.479
y4_elg -0.355
zpi 3.95
zy 5.79
z1pi 3.03
z2pi 3.256
z3pi 3.95
z4pi 1.12
z1y 4.49
z2y 5.74
z3y 2.755
z4y 1.54
AUX_ENDO_LAG_1_1 3.233
AUX_ENDO_LAG_0_1 -0.6977

error: Some element of Newton direction isn’t finite. Jacobian maybe singular or there is a problem with initial values
error: called from:
error: C:\dynare\4.4.3\matlab\lnsrch1.m at line 71, column 5
error: C:\dynare\4.4.3\matlab\solve1.m at line 107, column 20
error: C:\dynare\4.4.3\matlab\dynare_solve.m at line 150, column 16
error: C:\dynare\4.4.3\matlab\evaluate_steady_state.m at line 66, column 23
error: C:\dynare\4.4.3\matlab\steady_.m at line 54, column 27
error: C:\dynare\4.4.3\matlab\steady.m at line 81, column 30
error: C:\dynare\4.4.3\examples\Assenzadet.m at line 411, column 1
error: C:\dynare\4.4.3\matlab\dynare.m at line 180, column 1[/code]

Please describe what you are trying to do. A model with endogenous cycles will usually not have a steady state. This makes perturbation techniques not applicable. The perfect foresight solver will usually also not work, because you don’t know the terminal condition.

The idea is to implement a New Keynesian model with heterogeneous expectations instead of homogenous, rational expectations. In contrast to heterogeneous models with two types (like De Grauwe 2010,2011), this model assumes four types. However, expectations are still assumed to be aggregated as a linear combination of the four groups weighted by the group fractions. Therefore, I introduced auxiliary variables that replace the rational expectations operator.
As far as I know, the model has a RE steady state and I have chosen initial values such that it converges to this steady state after some initial (endogenous) fluctuations. This corresponds to the oscillatory convergence scenario in the paper mentioned above.

The model already runs in Matlab, but I thought it would be more convenient to implement a stochastic version in Dynare in order to calculate impulse response functions and variance decompositions.

The problem is that you seem to have non-linear dynamics. When using

you will be linearizing the model, losing this particular dynamics. Note also that variance decompositions and IRFs rely on (linear) state-space techniques where you have exogenous shocks and analyze their role. I doubt they are useful for this type of endogenous dynamics.