
/*declaration of endo. variables
 c: consumption
 R:nominal interest rate
 P:inflation
 K:capital
 y:output
 I:investment
 re:real interest rate
 L:loan
 S:Savings
 D:deposit
 ez:marginal cost shock
 eg:demand shock */

var c R p k y D re L S I ez eg ;

varexo  ug uz ;

parameters alpha //share of capital income
beta //discount factor
sigma //inverse elasticity of intertemporal substitution of consumption
delta //depr. rate
lambda // real marginal cost elasticity of inflation in Calvo model
rho_g //persistence of preference shock
rho_z //persistence of marginal cost shock
tao_inf //response of monetary policy rule to inflation
tao_y //response of monetary policy rule to output
tao_L //response of monetary policy rule to loan
si //share of investment in output
ci //share of consumption in output
sis //share of savings in output
tax // reserve requirement (loan tax )
sigma_ug //standart deviation of the preference shock
sigma_uz ;//standart deviation of the marginal shock cost



alpha=0.3;
beta=0.99;
delta=0.02;
lambda=0.3;
sigma=2;

rho_g =0.7;
rho_z =0.7;

tao_inf=1.5;
tao_y=0.25;
tao_L=2;

si=0.3;
ci=0.6;
sis=0.1;

tax=0.015;

sigma_ug=0.38;
sigma_uz=1;



model(linear);

c=(c(+1))-(1/(sigma))*(R-(p(+1)));
R=(1-beta*(1-delta))*((sigma)*(c(+1))+(1/1-alpha)*(y(+1)-(k)+ p(+1)));
p=beta*(p(+1))+lambda*((sigma)*c-(alpha/1-alpha)*(k(-1)-y))+ez;
k=si*I+(1-delta)*k(-1);
I(-1)=L;
L=(1-tax)*D;
y= ci*c+si*I+tax*sis*S;
S=I/(1-tax);
R=re+tao_inf *p+tao_y*y+tao_L*(L(+1)-L);
re=R-p(+1);
ez=rho_z*ez(-1)+uz;
eg=rho_g*eg(-1)+ug;
END;



steady ;
check;

shocks;
var uz=(sigma_uz)^2;
end;

tao_infs = [ 1.1000, 1.2000,1.3000];
tao_Ls = [ 1.1000, 1.2000, 1.3000];
tao_ys = [0.1000,0.2000,0.3000];
@#for i in 1:3
tao_inf=tao_infs(@{i});
@#for j in 1:3
tao_y=tao_ys(@{j});
@#for f in 1:3
tao_L=tao_Ls(@{f});


lambda1 = tao_infs;
lambda2 = tao_ys;
lambda3=tao_Ls;

optim_weights;
p lambda1;
y lambda2;
L lambda3;
end;

tao_inf=tao_infs;
tao_y =tao_ys;
tao_L=tao_Ls;
osr_params tao_inf tao_y tao_L;

osr(order=1,irf=12,noprint )R p L ;
@#endfor
@#endfor
@#endfor












