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_one*Ey+(1-a_one)*y(-1)+a_two*(r-Epi)+error_y;
pi = b_one*Epi+(1-b_one)*pi(-1)+b_two*y+error_pi;
r = c_one*(pi-target)+c_two*y+c_three*r(-1)+error_r;
Eyf = growth;
Eye = y;
Ey = Eye*alpha_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(gamma*Uye)/(exp(gamma*Uyf)+exp(gamma*Uye));
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(gamma*Upif)+exp(gamma*Upie));
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);