% Estimate parameters from a Taylor Rule
% y is output
% i is the nominal interest rate
% a is TFP
% pii is inflation
% For parameters: phi governs price stickiness, thetay and thetapi are the 
% coefficients of the policy rule

var y i a pii;

varexo e u;


parameters nstar beta rho sigmae sigmau thetapi phi thetay;

beta=.99; % discount factor
nstar=0.33; % steady state labor supply 

model (linear);

pii=(1-phi*beta)*(1-phi)/(phi*(1-nstar))*(y-a)+beta*pii(+1); % Phillips Curve
-y=i-pii(+1)-y(+1); % IS equation
i=thetapi*pii+thetay*(y-a)+u; % interest rate rule
a=rho*a(-1)+e; % evolution of natural rate of output

end;

varobs y;

estimated_params;
phi, 0.3;
thetapi, 1.5;
thetay, 1;
stderr e, .01;
stderr u, .01;
rho, 0.9;
end;

estimated_params_bounds;

phi, .01, .9;
thetapi, 1.01, 5;
thetay, .1, 3;
stderr e, 0.001, 2;
stderr u, 0.001, 2;
rho, 0.01, 0.99;
end;


estimation(datafile=pinew,mode_compute=1);

