//In the Name of Allah
//DSGE model: Version.7.(Date: 1397/09/08)Financial Frictions and Macroprudential Policy
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//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}}$,
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}}$,
//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;
csig=1.571;
msig=1.0721;
nsig=2.17;
csige=1.2;
bbe=0.975;
ddk=0.042;
aa=0.47;
nu=0.50;
rholv=0.60;
teta=0.0945;
rhoa=0.76;
bla=89.12509;
bga=6.27752;
bpi=1.045;
blv=0.80;
bn=.127777;
bw=0.003;
bor=0.049;
bkg=2.04;
bke=15.35714;
bi=0.279;
by=1;
bc=0.488;
bce=0.001;
bg=0.281;
brd=0.058763931;
brl=0.064042;
brrb=0.042184;
brk=0.047973;
bq=0.73;
betalo=2.79;
betade=-1.46;
omg=0.8;
kal=3;
kad=10;
bbp=0.97;
db=0.023;
rholo=0.80;
rhode=0.80;
kab=10;
car=.08;
rhog=0.44;
rhoko=0.68;
rhoo=0.72;
rhot=0.59;
gr=0.21;
ddg=0.0728;
xie=2.0317;
rhop=0.80;
rhoy=0.40;
rhorrs=0.802;
rhopi=0.89;
model (linear);
#EBC1=(bga/(bga+(bbe*bla/bpi)));
#EBC2=(bbe*bla/bpi)/(bga+(bbe*bla/bpi));
#EKO1=(bga*(1-ddk)*blv*bpi);
#BDD=(1+betade+(1+bbp)*kad);
#LBD=(betalo-1+(1+bbp)*kal);
#kap=((1-omg)*(1-omg*bbc))/omg;
#go=(rhoko*bor)/bkg;
#ik=bi/bke;
#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));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//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+EBC2*(lae(+1)-pi(+1))+rrl*rl;
//Equation 5:Entrepreneur Capital Demand
lae=(EKO1/bla)*(lv+pi(+1)+q(+1)+gae-q)+(bbe*(1-ddk)*(q(+1)-q+lae(+1)))+(bbe/bq)*(rk(+1)-brk*q+brk*lae(+1));
//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-(rrll)*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)*brk;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//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)+ik*i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//Monetary Sector Equations:
//Equation 27: Taylor rule
rrs=rhopi*pi(-1)+rhorrs*rrs(-1)+rhoy*(y-y(-1))+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
end;
initval;
cc=0;
pi=0;
rd=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;
g=0;
i=0;
psi=0;
y=0;
end;
steady;
check;
shocks;
var varlv;
stderr .01;
var vara;
stderr .01;
//var varetalo;
//stderr 0.01;
//var varetade;
//stderr 0.01;
//var varkb;
//stderr 0.01;
//var varg;
//stderr 0.01;
var varor;
stderr .01;//STDERROR=0.15 (R.13)
//var varkg;
//stderr 0.01;
//var varpsi;
//stderr 0.01;
//var varrrs;
//stderr 0.01;//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)
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.028, 0.005;// Depreciation rate (R.9)
rhoa,beta_pdf, 0.76, 0.02; //(R.12)
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;