
%New Keynesian Model 



% 1. Defining variables


%----------------------------------------------------------------

var y pi r;
varexo e1 e2 e3 ;

parameters a1 a2 b1 b2 c1 c2 c3;


%----------------------------------------------------------------


%----------------------------------------------------------------


% 2. Model


%----------------------------------------------------------------


model;
y = a1*y(+1) + (1-a1)*y(-1) + a2*(r-pi(+1)) + e1;
pi = b1*pi(+1) + (1-b1)*pi(-1) + b2*y + e2;
r = c1*(pi-0) + c2*y + c3*r + e3;
end;


%----------------------------------------------------------------

% 3. initial value;

%----------------------------------------------------------------



initval;
y = 0;
pi=0;

e1=0;
e2=0;
e3=0;

end;


%-------------------------------------------------------------------

estimated_params; 
a1, normal_pdf, 0, 0.05; 
a2, normal_pdf, 0, 0.05; 
b1, normal_pdf, 0, 0.05; 
b2, normal_pdf, 0, 0.05; 
c1, normal_pdf, 0, 0.05; 
c2, normal_pdf, 0, 0.05;
c3, normal_pdf, 0,0.05;
stderr e1, normal_pdf, 0, 0.005; 
stderr e2, normal_pdf, 0, 0.005; 
stderr e3, normal_pdf, 0, 0.005; 
end; 

varobs y pi r;
estimation(datafile=rationaldata,nograph,first_obs=1, mh_replic=20000) y pi r;
