//Dynare set-up: One-Sector NK Model with capital and costs of investment and with non-distortionary taxes
//////////////////////////////////////////////////////////////////////////////////////////////////
//This is a free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version. See for more information.
//////////////////////////////////////////////////////////////////////////////////////////////////
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%DECLARATION OF ENDOGENOUS VARIABLES%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
var LAMBDA $\Lambda$
LAMBDAC $\Lambda^C$
Rex $R^{ex}$
h WP
YW $Y^W$
Y
PWP $\frac{P^W}{P}$
K I tax C A G X Q XX
Z1 $Z^1$
Z2 $Z^2$
MC H
Htilde $\tilde{H}$
J
Jtilde $\tilde{J}$
PIE $\Pi$
Rn
INVPIE $\frac{1}{\Pi}$
RR RnRn YY CC hh WPWP II KK
S;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%DECLARATION OF OBSERVABLE VARIABLES%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
varobs S;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%DECLARATION OF EXOGENOUS VARIABLES%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
varexo epsA $\varepsilon^{A}$
epsG $\varepsilon^G$
epsM $\varepsilon^M$;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%DECLARATION OF PARAMETERS%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
parameters gy $\frac{G}{Y}$
varrho $\varrho$
alp $\alpha$
c
zzeta $\zeta$
betta $\beta$
delta $\delta$
sigma_c $\sigma_c$
rhoA $\rho^{A}$
rhoG $\rho^{G}$
Ass $\bar{A}$
phiX $\phi^X$
xi $\xi$
alpha_r $\alpha_r$
alpha_pie $\alpha_{\pi}$
iy
cy
epsilon
;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%CALIBRATION OF PARAMETERS%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gy=0.2;
varrho=0.6073;
alp=0.70;
zzeta=7.0;
c=1/zzeta;
betta=0.9871;
delta=0.0250;
sigma_c=2.0;
phiX=1.24;
xi=0.75;
%MP rule
alpha_r=0.7;
alpha_pie=1.5;
%Choice of Units
Ass=1;
%shock persistence
rhoA=0.7;
rhoG=0.7;
epsilon= 0.015;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%STEADY STATE RELATIONSHIPS%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
iy=((1-alp)*delta)/((1/betta-1+delta));
cy=1-iy-gy;
// ----------------------------
// *** DSGE-Model-equations ***
// ----------------------------
model;
%%%%%%%%%%%%%%%%%%%%%%%%%
%%Single period utility%%
%%%%%%%%%%%%%%%%%%%%%%%%%
LAMBDA=(((C^(1-varrho))*((1-h)^varrho))^(1-sigma_c)-1)/(1-sigma_c);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Marginal utility of consumption%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LAMBDAC=(1-varrho)*(C^((1-varrho)*(1-sigma_c)-1))*((1-h)^(varrho*(1-sigma_c)));
%%%%%%%%%%%%%%%%%%
%%Euler equation%%
%%%%%%%%%%%%%%%%%%
LAMBDAC=betta*XX(+1);
XX=(Rn(-1))/(PIE)*LAMBDAC;
%%%%%%%%%%%%%%%%%%%%%
%%Labour supply foc%%
%%%%%%%%%%%%%%%%%%%%%
varrho*(C^((1-varrho)*(1-sigma_c)))*((1-h)^(varrho*(1-sigma_c)-1))/LAMBDAC=WP;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Wholesale and retail sector relation%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Y=(1-c)*YW;
%%%%%%%%%%%%%%%%%%%%%%%
%%Production Function%%
%%%%%%%%%%%%%%%%%%%%%%%
YW=((A*h)^alp)*(K(-1))^(1-alp);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Wholesale firms FOC for labour%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PWP*(alp*YW)/h=WP;
%%%%%%%%%%%%%%%%%%%%%%%
%%Resource constraint%%
%%%%%%%%%%%%%%%%%%%%%%%
Y=C+G+I;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Capital law of motion%%%%%
%%Costs of investment case%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
X=I/I(-1);
K=I*(1-phiX*(X-1)^2.0)+(1-delta)*K(-1);
%%%%%%%%%%%%%%
%%Investment%%
%%%%%%%%%%%%%%
Z1=2.0*phiX*(X-1)*X*Q/(Rex(-1));
Q*(1- phiX*(X-1)^2.0-2.0*X*phiX*(X-1))+Z1(+1)=1;
%%%%%%%%%%%%%%%
%%Fischer Eqn%%
%%%%%%%%%%%%%%%
INVPIE=1/PIE;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Real ex-post interest rate%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Rex=(Rn(-1))*INVPIE;
%%%%%%%%%%%%%
%%Tobin's Q%%
%%%%%%%%%%%%%
Z2=(1-alp)*PWP*YW/K(-1)+(1-delta)*Q;
(Rn)*INVPIE(+1)=Z2(+1)/Q;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Balance budget constraint%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
G=h*WP*tax;
%%%%%%%%%%%%%%%%%%%%%%
%%Inflation Dynamics%%
%%%%%%%%%%%%%%%%%%%%%%
H-xi*betta*Htilde(+1)=Y*LAMBDAC;
J-xi*betta*Jtilde(+1)=(1/(1-(1/zzeta)))*Y*LAMBDAC*MC;
Htilde=(PIE^(zzeta-1))*H;
Jtilde=PIE^zzeta*J;
1=xi*(PIE^(zzeta-1))+(1-xi)*((J/H)^(1-zzeta));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Mark-up Monopolistic pricing%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MC=PWP;
%%%%%%%%%%%%%%%%%%%%%%%
%% Stcok Market%%
%%%%%%%%%%%%%%%%%%%%%%%
S = (betta / (1 + epsilon)) * S(+1) - (LAMBDAC / (1 + epsilon)) * Y(+1) - (Rn - INVPIE(+1) - Rex) ;
%%%%%%%%%%%%%%%
%%Taylor rule%%
%%%%%%%%%%%%%%%
log((Rn)/(STEADY_STATE(Rn)))=alpha_r*log((Rn(-1))/(STEADY_STATE(Rn)))+(alpha_pie*log((PIE)))+epsM;
%%%%%%%%%%%%%%%%%%%
%%Shock processes%%
%%%%%%%%%%%%%%%%%%%
log(A)-log(STEADY_STATE(A))=rhoA*(log(A(-1))-log(STEADY_STATE(A)))+epsA;
log(G)-log(STEADY_STATE(G))=rhoG*(log(G(-1))-log(STEADY_STATE(G)))+epsG;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Variables in deviation form%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
YY=Y/STEADY_STATE(Y);
KK=K/STEADY_STATE(K);
II=I/STEADY_STATE(I);
CC=C/STEADY_STATE(C);
WPWP=WP/STEADY_STATE(WP);
hh=h/STEADY_STATE(h);
RR=(Rex)/(STEADY_STATE(Rex));
RnRn=(Rn)/(STEADY_STATE(Rn));
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%INITIAL GUESSES FOR STEADY-STATE COMPUTATION%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
initval;
A=Ass;
Rex=1.0/betta;
PWP=1-1/zzeta;
h=(alp/cy*(1-varrho)/varrho)/(1+(alp/cy*(1-varrho)/varrho));
YW=A*h*(PWP*(1-alp)/(Rex-1+delta))^((1-alp)/alp);
WP=alp*PWP*YW/h;
K=PWP*(1-alp)/(Rex-1+delta)*YW;
I=(delta)*K;
Y=(1-c)*YW;
G=gy*Y;
C=Y-I-G;
tax=G/(WP*h);
%Post recursive Steady state relationship
LAMBDA=1/(1-sigma_c)*(C^((1-varrho)*(1-sigma_c))*(1-h)^(varrho*(1-sigma_c))-1);
LAMBDAC=(1-varrho)*C^((1-varrho)*(1-sigma_c)-1)*(1-h)^(varrho*(1-sigma_c));
XX=(Rex)*LAMBDAC;
Q=1;
X=1;
Z1=2.0*phiX*(X-1)*X*Q/(Rex);
Z2=(1-alp)*PWP*YW/K+(1-delta)*Q;
MC=PWP;
H=Y*LAMBDAC/(1-betta*xi);
Htilde=H;
J=H;
Jtilde=J;
PIE=1;
Rn=1/betta;
INVPIE=1;
YY=1;
CC=1;
hh=1;
WPWP=1;
II=1;
KK=1;
RR=1;
RnRn=1;
S= -6.5938;
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%BAYESIAN ESTIMATION STARTS HERE%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
estimated_params;
//
//
stderr epsA, INV_GAMMA_PDF,0.1,2; //technology
stderr epsG, INV_GAMMA_PDF,0.5,2; //government spending - rescaled stderr/gy
stderr epsM, INV_GAMMA_PDF,0.1,2; //interest rate rule
rhoA, BETA_PDF,0.5,0.20;//AR1 technology
rhoG, BETA_PDF,0.5,0.20;//AR1 government spending
phiX, NORMAL_PDF,2.00, 1.50; //investment adj cost
sigma_c, NORMAL_PDF,1.50, 0.375;//consumption utility
varrho, BETA_PDF, 0.50, 0.20; //preference
xi, BETA_PDF, 0.50, 0.10; //calvo prices
alp, BETA_PDF,0.70, 0.05; //labour share
alpha_pie, NORMAL_PDF,1.50, 0.25; //feedback inflation
alpha_r, BETA_PDF, 0.75, 0.10; //lagged interest rate
epsilon, BETA_PDF,0.5,0.20;//
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%SPECIFICATION OF SHOCKS%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
shocks;
var epsA; stderr 0.01;
var epsG; stderr 0.01;
var epsM; stderr 0.01;
end;
steady;
check;
estimation(datafile=Stock,IRF=10, mode_compute=4,presample=4,
prefilter=1,mh_replic=20000, mh_nblocks=5,mh_jscale=0.40,mh_drop=0.2);
//write_latex_dynamic_model;