# Purely backward locking model

Hi
i am new to dynare and encountered problems trying to simulate a NKM with backward looking expectations. As in DeGrauwe 2010 expectations are formed either naivly backwardlooking or according to the steady state values, with individuals deciding an the basis of the 2 expectation rules’ past performance according to squared deviations.
While this model could be implemented in excel i wonder why it doesnt work in dynare. Something seems to go wrong with the squared deviations individuals use to evaluate the expectation rules. The Utility indexes of the 2 forecasting rules (Uye, Uyf, Upie, Upif) are not simulated as expected (they are always very close to zero) and correspondingly the forecasts are not plausible. Omitting the ^2 yields plausible results.
Can someone find the problem? Does this model violate some of dynare’s assumptions?
It is:

*var y pi r Ey Eyf Eye alpha_ye Uyf Uye Epif Epie Epi Upie Upif alpha_pie;
varexo error_y error_pi error_r;
parameters a_one a_two b_one b_two c_one c_two c_three target growth gamma sigma_one sigma_two sigma_three rho;

a_one = 0.5;
a_two = -0.2;
b_one = 0.5;
b_two = 0.05;
c_one = 1.5;
c_two = 0.5;
c_three = 0.5;
growth = 0;
target = 0;
gamma = 1;
sigma_one = 0.5;
sigma_two = 0.5;
sigma_three = 0.5;
rho = 0.5;

model;
y = a_oneEy+(1-a_one)y(-1)+a_two(r-Epi)+error_y;
pi = b_one
Epi+(1-b_one)pi(-1)+b_twoy+error_pi;
r = c_one*(pi-target)+c_twoy+c_threer(-1)+error_r;
Eyf = growth;
Eye = y;
Ey = Eyealpha_ye+Eyf(1-alpha_ye);
Uyf = -1(1-rho)rho(y(-1)-Eyf(-2))^2+Uyf(-1)rho;
Uye = -1
(1-rho)rho(y(-1)-Eye(-2))^2+Uye(-1)rho;
*
alpha_ye = exp(gammaUye)/(exp(gammaUyf)+exp(gammaUye));
Epif = target;
Epie = pi;
Epi = Epie
alpha_pie+(1-alpha_pie)Epif;
Upif = -1(1-rho)rho(pi(-1)-Epif(-2))^2+Upif(-1)rho;
Upie = -1
(1-rho)rho(pi(-1)-Epie(-2))^2+Upie(-1)rho;

alpha_pie = exp(gamma
Upie)/(exp(gammaUpif)+exp(gammaUpie));
end;

initval;
y = 0;
pi = 0;
r = 0.01;
Eyf = 0;
Eye = 0;
Ey = 0;
Uyf = 1;
Uye = 0;
alpha_ye = 0;
Epif = 0;
Epie = 0;
Epi = 0;
Upif = 1;
Upie = 0;
alpha_pie = 0;
end;

check;

shocks;
var error_y = sigma_one;
var error_pi = sigma_two;
var error_r = sigma_three;
end;

stoch_simul(periods=1000, nograph, solve_algo = 2, order = 1);

It might do nothing to solve your problem, but the steady state is wrong. You did not put “steady” before check, so your initial values are taken as the true steady state values, which is apparently not the case. Set the check command and you will see the true steady state values for the entered model.

Indeed, i forgot that line in the skript i copied here, but that doesnt change the problem unfortunately. Thanks anyway.

Your model obviously has problems: you have several endogenous variables with zero variance.

For example, “Eyf” is set equal to “growth” (a parameter) and is therefore constant. Similarly, “Uye” is also constant (since “y” is equal to “Eye”). And so on…

Dynare correctly reports these variable as having zero variance.

Sebastien, thank you for your hints.

I dropped the unneccessary variables, but the problem remains the same.

The alphas and Us are constant (at 0.5 and 0). The Us are not correctly determined (they determine the alphas).

What strikes me is that changing ^2 to ^1 (see bold part of the code) changes the picture. Can it be related to the linearization that dynare conducts? Is there a need to linearize these equations, even though they are purely predetermined? Yet changing “model” to “model (linear)” doesn’t help.

Might this be the source of the error and how could I cope with it?

What the model should do:
1st block: 3 equations standart NKM with smoothing Taylor rule
2nd block: determination of irrational expactations of the outputgap (Ey) as an average of extrapolative (alpha_ye) and steady state expectations, weighted according to their historical performance in terms of squared deviation (Uye and Uyf).
3rd block: determination of irrational expactations of inflation (Epi) as an average of extrapolative (alpha_pie) and steady state expectations, weighted according to their performance in terms of squared deviation (Upie and Upif).

Thanks for any support!!!
Dominik

*var y pi r Ey alpha_ye Uyf Uye Epi Upie Upif alpha_pie;
varexo error_y error_pi error_r;
parameters a_one a_two b_one b_two c_one c_two c_three target growth gamma sigma_one sigma_two sigma_three rho;

a_one = 0.5;
a_two = -0.2;
b_one = 0.5;
b_two = 0.05;
c_one = 1.5;
c_two = 0.5;
c_three = 0.5;
growth = 0;
target = 0;
gamma = 1;
sigma_one = 0.5;
sigma_two = 0.5;
sigma_three = 0.5;
rho = 0.5;

model;
y = a_oneEy+(1-a_one)y(-1)+a_two(r-Epi)+error_y;
pi = b_one
Epi+(1-b_one)pi(-1)+b_twoy+error_pi;
r = c_one*(pi-target)+c_twoy+c_threer(-1)+error_r;

Ey = y(-1)alpha_ye+growth(1-alpha_ye);
Uyf = -1(1-rho)rho(y(-1)-growth)^2+Uyf(-1)rho;
Uye = -1
(1-rho)rho(y(-1)-y(-2))^2+Uye(-1)rho;
*
alpha_ye = exp(gammaUye)/(exp(gammaUyf)+exp(gamma*Uye));

Epi = pi(-1)alpha_pie+(1-alpha_pie)target;
Upif = -1(1-rho)rho(pi(-1)-target)^2+Upif(-1)rho;
Upie = -1
(1-rho)rho(pi(-1)-pi(-2))^2+Upie(-1)rho;

alpha_pie = exp(gamma
Upie)/(exp(gamma
Upif)+exp(gamma*Upie));
end;

initval;
y = 0;
pi = 0;
r = 0.01;
Ey = 0;
Uyf = 1;
Uye = 0;
alpha_ye = 0;
Epi = 0;
Upif = 1;
Upie = 0;
alpha_pie = 0;
end;

steady;
check;

shocks;
var error_y = sigma_one;
var error_pi = sigma_two;
var error_r = sigma_three;
end;

stoch_simul(periods=1000, nograph, solve_algo = 2, order = 1);