%See DYNARE manual 

%%Endogenous variables
var y p r e q yw pw z; 

%%List the observed variables below

varobs y p r e q;

%%Exogenous variables
varexo uyw upw uq ur uz; 

%%Parameters list
parameters csi1 csi2 csi3 t a cz rstar k cr cq cyw cpw sigmar sigmaq sigmaz sigmayw sigmapw;

%%Declaration of the model
model(linear);
#b = exp(-rstar/400);
y = y(+1)-(t+a*(2-a)*(1-t))*(r-p(+1))-cz*z-a*(t+a*(2-a)*(1-t))*q(+1)+a*(2-a)*((1-t)/t)*yw(+1); %%IS curve equation
p = b*p(+1)+a*b*q(+1)-a*q+(k/(t+a*(2-a)*(1-t)))*(y-((-a*(2-a)*(1-t))/t*yw)); %%Phillips curve equation
p=e+(1-a)*q+pw; %%CPI equation
r=cr*r(-1)+(1-cr)*(csi1*p+csi2*y+csi3*e)+ur; %%policy rule equation
q=cq*q(-1)+uq; %%ToT law of motion equation
yw=cyw*yw(-1)+uyw; %%law of motion for RoW output
pw=cpw*pw(-1)+upw; %%law of motion of rest of the RoW inflation
z=cz*z(-1)+uz;
end;

shocks;
var ur = sigmar;
var uq = sigmaq;
var uz = sigmaz;
var uyw = sigmayw;
var upw = sigmapw;
end;


%%List all parameters to be estimated and specifies bounds and priors below

estimated_params;
csi1, gamma_pdf, 1.5, 0.5;
csi2, gamma_pdf, 0.25, 0.13;
csi3, gamma_pdf, 0.25, 0.13;
t, beta_pdf, 0.5, 0.2;
a, beta_pdf, 0.2, 0.05;
cz, beta_pdf, 0.2, 0.05;
rstar, gamma_pdf, 2.5, 1; 
k, gamma_pdf, 0.5, 0.25;
cr, beta_pdf, 0.5, 0.2;
cq, beta_pdf, 0.4, 0.2;
cyw, beta_pdf, 0.9, 0.05;
cpw, beta_pdf, 0.8, 0.1;
sigmar, inv_gamma_pdf, 0.5, 4;
sigmaq, inv_gamma_pdf, 1.5, 4;
sigmaz, inv_gamma_pdf, 1, 4;
sigmayw, inv_gamma_pdf, 1.5, 4;
sigmapw, inv_gamma_pdf, 0.55, 4;
end;

%%Below compute estimation and specify file with data



estimation (datafile = teste) y p r e q;




