| 1 |
var r, pi, n, w, y, mc, x, rr, yobs, piobs,robs; |
| 2 |
|
| 3 |
var y_star, n_star, w_star; |
| 4 |
var y_f,pi_f,y_e,pi_e, pi_exp,y_exp; |
| 5 |
%Exogenous process (common to both specifications) |
| 6 |
var a, nu, u; |
| 7 |
%Shocks (common to both specifications) |
| 8 |
varexo eps_a,eps_nu,eps_u; |
| 9 |
%model parameters (common to both specifications) |
| 10 |
parameters h, gama, phi, bet, var_omega, kappa, iota_r, iota_y, iota_pi,iota_piexp; |
| 11 |
%shock persistence (common to both specifications) |
| 12 |
parameters rho_a,rho_nu,rho_u; |
| 13 |
%some steady state variables (common to both specifications) |
| 14 |
parameters a_ss, n_ss, mc_ss; |
| 15 |
% learning parameters |
| 16 |
parameters theta, rho,sigmaScale; |
| 17 |
|
| 18 |
parameters alpha_pi_e, alpha_pi_f, alpha_y_f, alpha_y_e; |
| 19 |
|
| 20 |
%---------------------------------------------------------------- |
| 21 |
% Parametrization |
| 22 |
%---------------------------------------------------------------- |
| 23 |
%model parameters |
| 24 |
h=0.5; %%%%%%%%%%to be matched with moments habit (0,1) |
| 25 |
gama=1; %%%%%%%%%%to be matched with moments inverse of the inter. elasticity of subst. |
| 26 |
phi=1;%%%%%%%%%%to be matched with moments %inverse of the Frisch |
| 27 |
bet=0.99; %%%%%%%%%%set |
| 28 |
var_omega=0.75; %%%%%%%%%%to be matched with moments Calvo's probability |
| 29 |
kappa=0.5;%%%%%%%%%%to be matched with moments Past indexation (0,1) |
| 30 |
%labor |
| 31 |
n_ss=0.2; |
| 32 |
%elasticity of substituion across varieties sigma |
| 33 |
sigma=6; |
| 34 |
%marginal cost |
| 35 |
mc_ss=(sigma-1)/sigma; |
| 36 |
%profit_share |
| 37 |
profit_share=1/sigma; |
| 38 |
wage_share=1-profit_share; |
| 39 |
%use the demand for labor |
| 40 |
a_ss=(wage_share)/(mc_ss*n_ss); |
| 41 |
% % Taylor rule parameters |
| 42 |
iota_r=0.2; %set %%%%%%%%%% to be estimated |
| 43 |
iota_y=0.5/4; %set%%%%%%%%%% to be estimated |
| 44 |
iota_pi=1.5; %set%%%%%%%%%% to be estimated |
| 45 |
iota_piexp=0; %set%%%%%%%%%% to be estimated |
| 46 |
rho_a=0.8; %%%%%%%%%%to be matched with moments persistence tech shock |
| 47 |
rho_nu=0.8; %%%%%%%%%%to be matched with moments persistence demand shock |
| 48 |
rho_u=0.5; %%%%%%%%%%to be matched with moments existence monetary policy shock (usually lower than the other two) |
| 49 |
%Behavioral Parameters |
| 50 |
theta=2; %%%%%%%%%% to be estimated |
| 51 |
rho=0.5; %%%%%%%%%% to be estimated |
| 52 |
sigmaScale=0.005; %%%%%%%%%% Scale Parameter of the logistic function |
| 53 |
alpha_pi_e=0.5; |
| 54 |
alpha_pi_f=0.5; |
| 55 |
alpha_y_f=0.5; |
| 56 |
alpha_y_e=0.5; |
| 57 |
|
| 58 |
%---------------------------------------------------------------- |
| 59 |
% The Model |
| 60 |
%---------------------------------------------------------------- |
| 61 |
model; |
| 62 |
//Composite parameters |
| 63 |
#messy1=((1-var_omega*bet)/(1+bet*kappa))*(1-var_omega)/var_omega; % I coeff. NKPC |
| 64 |
#messy2=bet/(1+bet*kappa); % II coeff. NKPC |
| 65 |
#messy3=kappa/(1+bet*kappa); % III coeff. NKPC |
| 66 |
#epsilon_n=(a_ss*n_ss); %elasticity wrt n |
| 67 |
%sticky prices |
| 68 |
[name='Rep Euler Equation'] |
| 69 |
y*(1+h)=y(+1)+h*y(-1)-((1-h)/gama)*(r-pi(+1))+nu; |
| 70 |
%eq2 |
| 71 |
[name='Labor supply'] |
| 72 |
n=(w-gama*y/(1-h)+gama*h*y(-1)/(1-h))/phi; |
| 73 |
%eq3 |
| 74 |
[name='Production function'] |
| 75 |
y=epsilon_n*(a+n); |
| 76 |
%eq4 |
| 77 |
[name='Labor Demand'] |
| 78 |
w=mc+(y-n)+a; |
| 79 |
[name='Rep NKPC'] |
| 80 |
pi=messy1*mc+messy2*pi(+1)+messy3*pi(-1); |
| 81 |
%eq9 |
| 82 |
[name='Taylor Rule'] |
| 83 |
r=(1-iota_r)*(iota_pi*pi+iota_y*(y-y_star)+iota_piexp*pi_exp)+iota_r*r(-1)+u; |
| 84 |
%eq10 |
| 85 |
[name='Output Gap'] |
| 86 |
x=y-y_star; |
| 87 |
%%%%Flex prices |
| 88 |
%eq11 |
| 89 |
[name='Labor Supply - Flex Prices'] |
| 90 |
n_star=(w_star-gama*y_star/(1-h)+gama*h*y_star(-1)/(1-h))/phi; |
| 91 |
%eq12 |
| 92 |
[name='Production Function - Flex Prices'] |
| 93 |
y_star=epsilon_n*(a+n_star); |
| 94 |
%eq13 |
| 95 |
[name='Labor Demand - Flex Prices'] |
| 96 |
w_star=y_star-n_star+a; |
| 97 |
% % % % % % % % Equation swap |
| 98 |
%eq17 |
| 99 |
[name='Rational Expectation Y'] |
| 100 |
y_f=y(+1); |
| 101 |
% %eq18 |
| 102 |
[name='Rational Expectation PI'] |
| 103 |
pi_f=pi(+1); |
| 104 |
% % Fundamentalist |
| 105 |
%eq19 |
| 106 |
[name='Extrapolative Expectation Y'] |
| 107 |
y_e=y(-1); |
| 108 |
%eq20 |
| 109 |
[name='Extrapolative Expectation PI'] |
| 110 |
pi_e=pi(-1); |
| 111 |
%eq21 |
| 112 |
[name='Mkt Expectation Y'] |
| 113 |
y_exp=alpha_y_f*y_f+alpha_y_e*y_e; |
| 114 |
%eq22 |
| 115 |
[name='Mkt Expectation PI'] |
| 116 |
pi_exp=alpha_pi_f*pi_f+alpha_pi_e*pi_e; |
| 117 |
%eq31 |
| 118 |
[name='Real Interest Rate'] |
| 119 |
rr=r-pi(+1); |
| 120 |
% Observation Equations |
| 121 |
yobs=y; |
| 122 |
piobs=pi; |
| 123 |
robs=r; |
| 124 |
%Exogenous process |
| 125 |
%eq33-36 |
| 126 |
[name='TFP Shock'] |
| 127 |
a=rho_a*a(-1)+eps_a; |
| 128 |
[name='Demand Schock'] |
| 129 |
nu=rho_nu*nu(-1)+eps_nu; |
| 130 |
[name='Monetary Policy Shock'] |
| 131 |
u=rho_u*u(-1)+eps_u; |
| 132 |
end; |
| 133 |
|
| 134 |
steady_state_model; |
| 135 |
mc=0; |
| 136 |
n=0; |
| 137 |
w=0; |
| 138 |
pi=0; |
| 139 |
piobs=0; |
| 140 |
r=0; |
| 141 |
robs=0; |
| 142 |
y=0; |
| 143 |
yobs=0; |
| 144 |
x=0; |
| 145 |
rr=0; |
| 146 |
n_star=0; |
| 147 |
y_star=0; |
| 148 |
w_star=0; |
| 149 |
a=0; |
| 150 |
nu=0; |
| 151 |
u=0; |
| 152 |
y_f=0; |
| 153 |
pi_f=0; |
| 154 |
y_e=0; |
| 155 |
pi_e=0; |
| 156 |
pi_exp=0; |
| 157 |
y_exp=0; |
| 158 |
end; |
| 159 |
|
| 160 |
|
| 161 |
steady; |
| 162 |
check; |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
M_.Sigma_e=eye(M_.exo_nbr)*0; |
| 167 |
shocks; |
| 168 |
var eps_a; stderr 0.01; |
| 169 |
end; |
| 170 |
|
| 171 |
|
| 172 |
varobs yobs piobs robs ; |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
stoch_simul(order = 1,irf=40, periods=0, partial_information,contemporaneous_correlation,TeX)y,x,pi,r,rr; |
| 177 |
collect_latex_files; |
| 178 |
|
| 179 |
[status, cmdout]=system(['pdflatex -halt-on-error -interaction=nonstopmode ' M_.fname '_TeX_binder.tex']); |
| 180 |
if status |
| 181 |
cmdout |
| 182 |
error('TeX-File did not compile.') |
| 183 |
end |