close all;

%----------------------------------------------------------------
% 1. Defining variables
%----------------------------------------------------------------

var  k c r y z;
varexo e1; 
parameters BETA DELTA SIP RHO SIGMA ENE;

%----------------------------------------------------------------
% 2. Calibration
%----------------------------------------------------------------
BETA= 0.99;
DELTA= 0.025;
SIP= 0.95;
RHO= 0.36;
SIGMA=0.03;
ENE=1;

%----------------------------------------------------------------
% 3. Model
%----------------------------------------------------------------

model;
exp(y)=exp(z)*exp(k(-1))^(RHO);
0     =exp(c)+exp(k)-(1-DELTA)*exp(k(-1))-exp(z)*exp(k(-1))^(RHO);
exp(r)=(1-DELTA)+RHO*exp(z)*exp(k(-1))^(RHO-1);
1     =BETA*(exp(r(+1))*(exp (c))/(exp(c(+1)))^ENE);  
exp(z)=exp(e1)*exp(z(-1))^SIP;

end;

varobs y;
%----------------------------------------------------------------
% 4. Computation
%----------------------------------------------------------------

initval;
c= 1.01;
k=3.63;
r=0.01;
z=0.01;
y=1.01;
end;


resid(1);

steady;
%check;

estimated_params;
BETA, beta_pdf, 0.99, 0.002;
DELTA, beta_pdf, 0.025, 0.005;
SIP, beta_pdf, 0.95, 0.005;
RHO, beta_pdf, 0.36, 0.001;
SIGMA, inv_gamma_pdf, 0.035449, inf;
end;



estimation(datafile=fsdatb,nobs=192,loglinear,mh_replic=2000,
	mode_compute=6,mh_nblocks=2,mh_drop=0.45,mh_jscale=0.65);