//In the Name of Allah
//DSGE model: (Date: 1397/09/22)Financial Frictions and Macroprudential Policy
//The Base Model;;;;Macrpprudential policy+government+Bank
var
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Variables of Consumer Equations:
//First Equation Variables
cc${\hat{c}^{c}}$ rd$\hat{r}^{d}$ pi$\hat{\pi}$
//Second Equation Variables
n$\hat{n}$ w$\hat{w}$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Variables of Entrepreneur Sector
//Thitrd Equation Variables
ce$\hat{c}^{e}$ lae$\hat{\lambda}^{e}$
//Fourth Equation Variables
gae$\hat{\gamma}^{e}$ rl$\hat{r}^{l}$
//fifth Equation Variables
lv$\hat{lv}$ q$\hat{q}$ rk$\hat{r}^{k}$
//Sixth Equation Variables
ye$\hat{y}^{e}$ x$\hat{x}$
//7th Equation Variables
ke$\hat{k}^{e}$ kg$\hat{k}^{g}$ a$\hat{a}$
//8th Equation Variables
or$\hat{or}$
//9th Equation Variables
//10th Equation Variables
b$\hat{b}$
//11th Equation Variable
//12th Equation Variable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Retail Sector:
//13th Equation Variable
phi$\hat{\phi}$
//14th Equation Variable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Banking Sector
//15th Equation Variables
rrb$\hat{rrb}$ rrs$\hat{rrs}$ kb$\hat{k}^{b}$
//16th Equation Variables
etalo${\eta}^{lo}$
//17th Equation Variables
etade${\eta}^{de}$
//18th Equation Variable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Government Sector
//21th Equation Variables
g$\hat{g}$
//22th Equation Variables
//23th Equation Variables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Capital Producer Sector
//24th Equation Variables
psi$\hat{\psi}$
//26th Equation Variables
i$\hat{i}$
//27th Equation Variables
k$\hat{k}$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Monetary Sector
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//28th Equation Variables: Market Clearing Condition
y$\hat{y}$;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
varexo
varlv$\varepsilon^{LV}$
vara$\varepsilon^{a}$
varetalo$\varepsilon^{eta_lo}$
varetade$\varepsilon^{eta_de}$
varkb$\varepsilon^{k_b}$
varg$\varepsilon^{g}$
varor$\varepsilon^{or}$
varkg$\varepsilon^{kg}$
varpsi$\varepsilon^{\psi}$
varrrs$\varepsilon^{rrs}$;
parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Consumer Equations:
//First Equation Parameters
bbc${\beta^{c}}$,//It is not needed?
csig${\sigma_{c}}^{c}$ (long_name='Consumer Elasticity of Substituition'),
//2nd Equation Parameters
msig${\sigma_{c}}^{m}$ (long_name='Money Elasticity of Substitution'),
//3rd Equation Parameters
nsig${\sigma_{c}}^{n}$ (long_name='Frisch Elasticity of Labor Supply'),
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Entrepreneur Sector
//4th Equation Parameters
csige${\sigma_{e}}^{c}$ (long_name='Entrepreneur Elasticity of Substituition'),
//5th Equation Parameters
bbe$\beta^{e}$,
//6th Equation Parameters
ddk$\delta_{k}$ (long_name='Depreciation rate'),
aa$\alpha$ (long_name='Share of Capital in Production'),
bla$\bar{\lammbda^{e}}$,
bga$\bar{\gamma^{e}}$,
bpi$\bar{\pi}$,
blv$\bar{lv}$,
bn$\bar{n}$,
bor$\bar{or}$,
bkg$\bar{kg}$,
bke$\bar{ke}$,
bi$\bar{i}$,
by$\bar{y}$,
bc$\bar{cc}$,
bce$\bar{ce}$,
bg$\bar{g}$,
brd$\bar{rd}$,
brl$\bar{rl}$,
brrb$\bar{rrb}$,
brk$\bar{rk}$,
betade$\bar{\eta^{de}}$,
betalo$\bar{\eta^{lo}}$,
bk$\bar{k}$,
//8th Equation Parameters
teta$\theta$,
//9th Equation Parameters
nu$\nu^{or}$,
//9th Equation Parameters
//rholv$\rho^{lv}$,
//10th Equation Parameters
rhoa$\rho^{a}$,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of retail Sector
//13th Equation Parameters
omg$\omega$,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Banking Sector
//15th Equation Parameters
kad${\kappa^{d}}$,
bbp${\beta_{p}}$,
//16th Equation Parameters
kal${\kappa^{l}}$,
//18th Equation Parameters
db$\delta_{b}$(long_name='Depreciation rate of Bank Capital'),
kab${\kappa^{b}}$(long_name='Adjustment Coeeficient in Wholesale Branch cost Function'),
car$car$(long_name='Banking Capital ratio over assets (Basel II)'),
//20th Equation Parameters
rhode$\rho^{de}$,
//21th Equation Parameters
rholo$\rho^{lo}$,
//17th Equation parameters
//etalo${\eta}^{lo}$;,
//18th Equation parameters
//etade${\eta}^{de}$,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Government Sector
//23th Equation Parameters
rhog$\rho^{g}$,
//24th Equation Parameters
ddg$\delta_{g}$ (long_name='Depreciation of Public Investment'),
rhoko$\rho^{kgor}$,
//25th Equation Parameters
rhoo$\rho^{or}$,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Producing capital Sector
//27th Equation Parameters
//28th Equation Parameters
xie$\xi_{I}$,
bq${\bar{q}}$ (long_name='Steady state value of capital price'),
//29th Equation Parameters
rhop$\rho^{\psi}$,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Monetary Sector
//31th Equation Parameters
//rhorm$\rho^{\mu}$,
rhoy$\rho^{y}$,
rhorrs$\rho^{rrs}$,
rhopi$\rho^{\pi}$;
//31th Equation Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Parameters of Market Clearing Equation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bbc=0.987;//R1; (shah hosseini and bahrami (0.979)) (Komeijaniand Tavakolian = 0.987)
csig=1.571;//R1 & R8 (Komeijani and Tavakolian=1.30)
msig=1.0721;//R21
nsig=2.17;//R10
csige=1.571;//Gerali et. al (2009)
bbe=0.975;//daliri & mehregan (Brozaza-Brezina, Kolasa and Makarski (2010),Gerali et al (2009) (=0.975)) (=0.9085)
ddk=0.028;//R1 & R-8 (shah hosseini and bahrami (0.031)) (Eskandari, pedram and bostani (1397)=0.027) (hosein tavakolian komijani=0.0426)
aa=0.47;//tavakolian and komeijani (Dargahi and Hadian (1395) =0.412) (Eskandari, pedram and bostani (1397)=0.47)(0.4278=tavak and komi)
nu=0.10;//assumption
//rholv=0.60;//Gerali et al (2009)
teta=0.0945;//Komeijani and Tavakolian
rhoa=0.76;//R-2
bla=89.12509;//Computation
bga=6.27752;//Computation
bpi=1.045;//Teimour Rahmani (tarh)(=0.18/4=0.045)
blv=0.80;//Assumption
bn=.127777;//computation
bw=0.003;
bor=0.049;//Computattion
bkg=2.04;//computation (rhoorkg*boil/ddg)
bke=15.35714;//Computation (0..23/0.027)
bi=0.279;//computation
by=1;//computation
bc=0.488;//computation
bce=0.001;//computation
bg=0.281;//computation
brd=0.058763931;//Compute from Foc Condition (((in Teimour rahmani (tarh) (brd=0.20/4)
brl=0.064042;//Compute from Foc Condition (Teimour rahmani (tarh)((brl=.22/4))
brrb=0.042184;//=brrs;((Teimour rahmani Tarh (brrs=0.20)
brk=0.047973;// (Amiri (1394)=.08)
bq=0.73;//Marzie Bayat, Tavakolian and ....
betalo=2.79;//(Heidary and Molabahrami (2.79))
betade=-1.46;//Heidary and Molabahrami
bk=17.39714;
omg=0.58;//R.22
kal=3;//Gerali et al (2009) (Farsi: Hosseini and Molabahrami)
kad=10;//Gerali et al (2009)(Farsi: Hosseini and Molabahrami)
bbp=0.97;//Consumers are bank owner
db=0.023;//Shahhoseini and Bahrami (1391)
rholo=0.80;//Gerali etal (2009)
rhode=0.80;//Gerali etal (2009)
kab=10;//Gerali, et. al (2009)
car=.08;//Central Bank determine CAR ratio (Teimour rahmani (tarh)) (Mohebi, Shahrestani and Hojabri (1396))
rhog=0.44;//R.22
rhoko=0.68;//R.20
rhoo=0.72;//R-2,14 (=.55) (.72=R.11)
rhot=0.59;//R-11,12
gr=0.21;//R-33
ddg=0.030;//sayadmanesh and teimori//tavakolian and komeijani 1391 (R-9=0.0728)
xie=2.0317;//R.15
rhop=0.80;//Amiri (1394)
//rhorm=0.8267;//Shah hosseini & Bahrami
rhoy=0.46;//Shah hosseini & Bahrami
rhorrs=0.80320;//Shah hosseini & Bahrami
rhopi=0.87;//Shah hosseini & Bahrami (daliri & Mehregan=0.60)
model (linear);
#EBC1=((1+brl)*bga/bla);
#EBC2=(bbe*(1+brl)/bpi);
#EKO1=(bga*(1-ddk)*blv*bpi*bq);
#EKO2=bbe*bla*(bq*(1-ddk)+brl);
#BDD=(1+betade+(1+bbp)*kad);
#LBD=(betalo-1+(1+bbp)*kal);
#kap=((1-omg)*(1-omg*bbc))/omg;
#go=(rhoko*bor)/bkg;
#ccy=bc/by;
#cey=bce/by;
#gy=bg/by;
#iy=bi/by;
#ory=bor/by;
#rrd=(1/brd);
#rrl=(1/(1+brl));
#kabr=kab/brrb;
#rrll=(brl/(1+brl));
#k1=bke/bk;
#k2=bkg/bk;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Consumer Sector
//Equation 1:Consumption of Household
cc=cc(+1)-(1/csig)*(rd-pi(+1));
//Equation 2:Supply of Labor
n=(1/nsig)*(w-csig*cc);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Entrepreneur Sector
//Equation 3:Entrepreneur Consumption
ce=(-1/csige)*lae;
//Equation 4:Entrepreneur Loan Demand
lae=EBC1*(gae+rrl*rl)+EBC2*(lae(+1)+rrl*rl-pi(+1));
//Equation 5:Entrepreneur Capital Demand
lae=((EKO1/bla*bq)*(lv+pi(+1)+q(+1)+gae))+((EKO2/bla*bq)*((bq*(1-ddk)/(bq*(1-ddk)+brl)))*q(+1)+(rl/(bq*(1-ddk)+brl)))-q;
//Equation 6:Entrepreneur Labor Demand
w=ye-n-x;
//Equation 7:Production function of Entrepreneur
ye=a+aa*ke(-1)+(1-aa)*n+teta*kg(-1);
//Equation 8: Macroprudential Policy (process defined for evolution of LTV)
lv=-nu*(or-or(-1))+varlv;
//Equation 9: AR(1) Process for TFP Shock
a=rhoa*a(-1)+vara;
//Equation 10: Borrowing Constraint of firm
b=lv+q(+1)+pi(+1)+ke-rl;
//Equation 11: Relative price of Entreprenuer good (x)
-x=aa*rk+(1-aa)*w-a-teta*kg(-1);
//Equation 12: Rent Of Capital
rk=(a+(aa-1)*ke(-1)+(1-aa)*n+teta*kg(-1)-x);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Retail Sector
//Equation 13:New Keynsian Philips Curve
pi=kap*phi+bbc*pi(+1);
//Equation 14: marginal cost
phi=-x;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Banking Sector Equations:
//Equation 15:FOC of Wholasale Branch
rrb=rrs-(kabr*((car)^3)*(kb-b));
//Equation 16: Loan Supply by Bank
rl=(kal/LBD)*rl(-1)+((bbp*kal)/LBD)*rl(+1)+((betalo-1)/LBD)*rrb+((betalo-1)/LBD)*etalo;
//Equation 17: Demand Deposit by Bank
rd=(kad/BDD)*rd(-1)+((bbp*kad)/BDD)*rd(+1)+((1+betade)/BDD)*rrs+((1+betade)/BDD)*etade;
//Equation 18: Capital Accumulation of Bank
kb=(1-db)*kb(-1)+varkb;
//Equation 19: Ar(1) Process for elasticity of substitution between deposit interest rate
etade=rhode*etade(-1)+varetade;
//Equation 20: Ar(1) Process for elasticity of substitution between loan interest rate
etalo=rholo*etalo(-1)+varetalo;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Government Sector Equations:
//Equation 21: Government Expenditure Process
g=rhog*g(-1)+varg;
//Equation 22: Public Investment Process
kg=(1-ddg)*kg(-1)+go*or+varkg;
//Equation 23: oil revenue process
or=rhoo*or(-1)+varor;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Capital Producer Equations
//Equation 24: Q-Tobin Process
q=-psi+bq*xie*(i-i(-1))-bq*bbc*xie*(i(+1)-i);
//Equation 25: Shock to Marginal Efficiency of Investment
psi=rhop*psi(-1)+varpsi;
//Equation 26: Law Of Motion of Private Capital
ke=(1-ddk)*ke(-1)+ddk*i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Monetary Sector Equations:
//Equation 27: Taylor rule
rrs=rhopi*pi+rhorrs*rrs(-1)+rhoy*(y)+varrrs;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Equation 28: entreprenuer and retailer Output relation
y=ye;
//Equation 29: Market Clearing Condition
y=ccy*cc+cey*ce+gy*g+iy*i-ory*or;//Market Clearing Condition
//Equation 30: Capital Aggregation
k=k1*ke+k2*kg;
end;
initval;
cc=0;
pi=0;
rd=0;
//m=0;
w=0;
n=0;
ce=0;
rl=0;
b=0;
lae=0;
gae=0;
lv=0;
q=0;
ye=0;
x=0;
ke=0;
or=0;
kg=0;
a=0;
rk=0;
etalo=0;
etade=0;
rrb=0;
rrs=0;
kb=0;
phi=0;
k=0;
g=0;
i=0;
psi=0;
y=0;
end;
//steady;
//check;
shocks;
var varlv;
stderr .0001;
var vara;
stderr .0001;
//var varetalo;
//stderr 0.01;
//var varetade;
//stderr 0.01;
//var varkb;
//stderr 1;
//var varg;
//stderr 1;
var varor;
stderr .0001;//STDERROR=0.15 (R.13)
//var varkg;
//stderr 1;
//var varpsi;
//stderr 1;
//var varrrs;
//stderr 1;//STDERROR=0.14 (R.13)
end;
model_diagnostics;
varobs kg ke y q b or;
estimated_params_init(use_calibration);
end;
estimated_params;
//bbc, beta_pdf, .98, 0.02; //Consumer Preference (R.2)
csig, gamma_pdf, 1.571, 0.05; //Consumer Elasticity of Substitution (R.2)
//msig, gamma_pdf, 1.0721, 0.05; //money Elasticity of Substitution (R.8)
nsig, gamma_pdf, 2.17, 0.05; //labor elasticity of subsitution (R.2)
aa, beta_pdf, 0.47, 0.02; //capital Share in production (R.8)
ddk, beta_pdf, 0.042, 0.005;// Depreciation rate (R.9)
rhoa,beta_pdf, 0.76, 0.02; //(R.12) (is it between 0 and 1????)
teta, beta_pdf, 0.0945, 0.01;//Elasticity of Subs. between private and Government capital (R.8)
nu, normal_pdf, 0.50, 0.01;// Loan to value ratio (R.9: Defined a gamma distribution)
rhoo, beta_pdf, 0.72, 0.018; //Autoregressive of oil revenue coeef (R.9)
rhog, beta_pdf, 0.44, 0.04; //(R.12)
omg, beta_pdf, 0.58, 0.05; //Price Stickiness (R.2)
rhopi, normal_pdf, 1.20, 0.05; //(R.9) (Is itBetween 0 and 1???)
rhorrs, beta_pdf, 0.50, .01; //Assumption (Is itBetween 0 and 1???)
rholo,beta_pdf, 0.80, 0.01; //Gerali etal (2009)
rhode,normal_pdf,0.80,.01;//???
stderr vara, inv_gamma_pdf, .01, inf; //(R.12)
stderr varor, inv_gamma_pdf, .01, inf; //Standard Error of oil revenue (R.8)
stderr varg, inv_gamma_pdf, .01, inf; //(R.12)
end;
//dynare_sensitivity ;
//identification (advanced=1, max_dim_cova_group=3, prior_mc=250, lik_init=3) ;
//estimation(tex,datafile=mydata3,mode_compute=6) kg ke y q b or;
//stoch_simul(tex,hp_filter=1600,order=1,periods=10000,irf=40);
//stoch_simul(tex);
write_latex_dynamic_model;
write_latex_parameter_table;
write_latex_definitions;
collect_latex_files;