Optimal Simple Rule

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Optimal Simple Rule

Postby sirene » Sun Aug 25, 2013 9:22 am

Dear experts,

I've written my own model, and solve for only one paramater values,it now works.However, I need to run model for different values,and calculate the loss function.Now, I''m so much confused how to continue..Besides,I write a loop code for 3 different values for 3 different parameters,(for just a try,since more more different values I need to consider),but I dont know how to calculate the loss function. I have written OSR for this case,but it does not work unfortunately...I attach the files,if you look and help me..

Thank you very much for any suggestions in advance,
I'm looking forward any comment\suggestions.
Sincerely,

Without OSR; ((L4.mod, I will attach below)
/*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});


stoch_simul(periods=1000,order=1,irf=12);
@#endfor
@#endfor
@#endfor

With OSR; (L5.mod, I will attach below)

/*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
Attachments
L4.mod
(1.96 KiB) Downloaded 156 times
L5.mod
(2.16 KiB) Downloaded 152 times
sirene
 
Posts: 14
Joined: Fri Jul 19, 2013 1:16 pm

Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 11 guests