/
Sims_2012_RBC.mod
187 lines (163 loc) · 5.45 KB
/
Sims_2012_RBC.mod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
* This file replicates the results for the basic RBC model presented in Eric R. Sims (2012):
* "New, Non-Invertibility, and Structural VARs", Advances in Econometrics, Volume 28, 81–135
*
* In particular, it performs the ABCD-test of Fernandez-Villaverde, Rubio-Ramirez,Sargent,
* and Watson (2007), "ABCs (and Ds) of Understanding VARs", American
* Economic Review, 97(3), 1021-1026
* This mod-file strips away all features from the full model not used in the RBC model.
* In particular, epsilon has been set to Infinity, and investment adjustment costs, habits, and
* monetary policy have been dropped from the model.
*
* This file require the ABCD_test.m from the FV_et_al_2007-folder to be located in the same folder.
*
* This file was written by Johannes Pfeifer.In case you spot mistakes, email me at jpfeifer@gmx.de
*
* The model is written in the beginning of period stock notation. To make the model
* conform with Dynare's end of period stock notation, I use the
* predetermined_variables-command.
*
* Please note that the following copyright notice only applies to this Dynare
* implementation of the model
*/
/*
* Copyright (C) 201315 Johannes Pfeifer
*
*
* This is 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.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You can receive a copy of the GNU General Public License
* at <http://www.gnu.org/licenses/>.
*/
var c lambda $\lambda$ w n R y mu_a mu_y invest k z1 z2 z3; //interest pi //drop monetary policy
varexo epsilon u;
predetermined_variables k;
parameters alpha $\alpha$
beta $\beta$
theta $\theta$
delta $\delta$
xi $\xi$
delta_I ${\Delta_I}$
rho $\rho$
phi_pi $\phi_\pi$
phi_y $\phi_y$
pi_star $pi^*$
delta_y ${\Delta_y}$
g_a $g_a$
sigma_eps $\sigma_eps$
sigma_u $\sigma_u$;
beta=0.99;
delta=0.02;
pi_star=0.005;
alpha=1/3;
xi=1;
sigma_eps=0.01;
sigma_u=0.005;
theta=0; //set in SS
rho=0.8;
phi_pi=1.5;
phi_y=1.5;
g_a=0.0025;
delta_y=exp(g_a)^(1/(1-alpha));
delta_I=delta_y;
model;
[name='Resource Constraint']
c+invest=exp(y);
[name='LOM capital']
exp(k(+1))=invest+(1-delta)*exp(k)/mu_y;
[name='Lagrange multiplier']
lambda=1/c;
[name='FOC labor']
theta*n^xi=lambda*w;
//5. Euler equation Bonds
//lambda=beta/mu_y(+1)*lambda(+1)*(1+interest)/(1+pi(+1));
[name='Euler equation capital']
lambda=beta/mu_y(+1)*lambda(+1)*(R(+1)+(1-delta));
[name='Output']
exp(y)=(exp(k)/mu_y)^alpha*n^(1-alpha);
[name='FOC labor']
w=(1-alpha)*exp(y)/n;
[name='FOC Interest']
R=alpha*exp(y)/(exp(k)/mu_y);
//[name='Taylor Rule']
//interest=rho*interest(-1)+(1-rho)*steady_state(interest)+phi_pi*(pi-pi_star)+(1-rho)*phi_y*(y/y(-1)-1);
[name='Technology growth']
mu_a=g_a+epsilon+z1(-1); //mu_a=ln a_t - ln a_{t-1}
[name='Output growth factor']
mu_y=exp(mu_a)^(1/(1-alpha));
[name='Auxiliary variable 1']
z1=z2(-1);
[name='Auxiliary variable 2']
z2=z3(-1);
[name='Auxiliary variable 3']
z3=u;
end;
shocks;
var epsilon; stderr sigma_eps;
var u; stderr sigma_u;
end;
steady_state_model;
mu_a=g_a;
mu_y=exp(mu_a)^(1/(1-alpha));
n=1/3; //calibrate
k_bar=((1/(beta/mu_y)-(1-delta))/(alpha))^(1/(alpha-1))*n*mu_y;
w=(1-alpha)*(k_bar/mu_y/n)^alpha;
R=alpha*(k_bar/mu_y/n)^(alpha-1);
invest=(1-(1-delta)/mu_y)*k_bar;
pi=pi_star;
y_bar=(k_bar/mu_y)^alpha*n^(1-alpha);
c=y_bar-invest;
lambda=1/c;
interest=1/(beta/mu_y)*(1+pi)-1;
theta=lambda*w/n^xi;
k=log(k_bar);
y=log(y_bar);
end;
steady;
check;
write_latex_dynamic_model;
varobs mu_a y;
stoch_simul(order=1,irf=20) k y mu_a mu_y;
//************************************* Replicate the theoretical IRFs of Figure 2: Monte Carlo Results in RBC Model
//Now back out IRF of non-stationary model variables by adding trend growth back
log_a_surprise(1,1)=0;
log_a_antic(1,1)=0;
log_mu_y_surprise_0=0; //Initialize Level of Technology at t=0;
log_mu_y_surprise(1,1)=log_mu_y_surprise_0;
log_y_nonstationary_surprise(1,1)=0;
log_mu_y_antic_0=0; //Initialize Level of Technology at t=0;
log_mu_y_antic(1,1)=log_mu_y_antic_0;
log_y_nonstationary_antic(1,1)=0;
// reaccumulate the non-stationary level series
for ii=2:options_.irf+1
log_a_surprise(ii,1)=log_a_surprise(ii-1,1)+oo_.irfs.mu_a_epsilon(1,ii-1);
log_a_antic(ii,1)=log_a_antic(ii-1,1)+oo_.irfs.mu_a_u(1,ii-1);
log_mu_y_surprise(ii,1)=oo_.irfs.mu_y_epsilon(1,ii-1)+log_mu_y_surprise(ii-1,1);
log_y_nonstationary_surprise(ii,1)=oo_.irfs.y_epsilon(1,ii-1)+log_mu_y_surprise(ii,1);
log_mu_y_antic(ii,1)=oo_.irfs.mu_y_u(1,ii-1)+log_mu_y_antic(ii-1,1);
log_y_nonstationary_antic(ii,1)=oo_.irfs.y_u(1,ii-1)+log_mu_y_antic(ii,1);
end
//Make the plot
figure('Name','IRF of non-detrended variables to a productivity shock');
subplot(4,1,1)
plot(1:options_.irf+1,log_a_surprise)
title('Surprise TFP')
subplot(4,1,2)
plot(1:options_.irf+1,log_y_nonstationary_surprise)
title('Output Surprise')
subplot(4,1,3)
plot(1:options_.irf+1,log_a_antic)
title('Antic TFP')
subplot(4,1,4)
plot(1:options_.irf+1,log_y_nonstationary_antic)
title('Antic Output')
//*************************************perform ABCD-test on model, replicates Appendix A.2
[result,eigenvalue_modulo,A,B,C,D]=ABCD_test(M_,options_,oo_)