| 1 |
heterogeneity_dimension households; |
| 2 |
|
| 3 |
var(heterogeneity=households) |
| 4 |
c // Consumption |
| 5 |
a // Assets |
| 6 |
Va // Derivative of the value function w.r.t assets |
| 7 |
; |
| 8 |
|
| 9 |
varexo(heterogeneity=households) |
| 10 |
e u |
| 11 |
; |
| 12 |
|
| 13 |
var |
| 14 |
Y // Aggregate output |
| 15 |
r // Rate of return on capital net of depreciation |
| 16 |
w // Wage rate |
| 17 |
K // Aggregate capital |
| 18 |
; |
| 19 |
|
| 20 |
varexo Z; // Aggregate productivity shock |
| 21 |
|
| 22 |
parameters |
| 23 |
L // Labor |
| 24 |
alpha // Share of capital in production fuction |
| 25 |
beta // Subjective discount rate of houselholds |
| 26 |
delta // Capital depreciation rate |
| 27 |
eis // Elasticity of intertemporal substitution |
| 28 |
Z_ss // Aggregate TFP shock average value |
| 29 |
; |
| 30 |
|
| 31 |
model(heterogeneity=households); |
| 32 |
c^(-1/eis)-beta*Va(+1)=0 ⟂ a>=0; |
| 33 |
(1+r)*a(-1)+w*e*u-c-a; |
| 34 |
Va = (1+r)*c^(-1/eis); |
| 35 |
end; |
| 36 |
|
| 37 |
model; |
| 38 |
[name='production'] |
| 39 |
(Z_ss+Z) * K(-1)^alpha * L^(1 - alpha) - Y; |
| 40 |
alpha * (Z_ss+Z) * (K(-1) / L)^(alpha - 1) - delta - r; |
| 41 |
(1 - alpha) * (Z_ss+Z) * (K(-1) / L)^alpha - w; |
| 42 |
[name='capital_market_clearing'] |
| 43 |
K - SUM(a); |
| 44 |
end; |
| 45 |
|
| 46 |
shocks; |
| 47 |
var Z; stderr 0.01; |
| 48 |
end; |
| 49 |
|
| 50 |
load 'ks_two_shocks.mat'; |
| 51 |
|
| 52 |
param_names = fieldnames(steady_state.params); |
| 53 |
for i=1:numel(param_names) |
| 54 |
param = param_names{i}; |
| 55 |
set_param_value(param, steady_state.params.(param)); |
| 56 |
end |
| 57 |
|
| 58 |
heterogeneity_compute_steady_state(filename=ks_two_shocks); |
| 59 |
|
| 60 |
heterogeneity_solve; |
| 61 |
|
| 62 |
if max(abs(oo_.heterogeneity.mat.G(:))) > 1e-4 |
| 63 |
error('Aggregate-block residuals are too big!'); |
| 64 |
end |
| 65 |
if max(abs(oo_.heterogeneity.mat.F(:))) > 1e-8 |
| 66 |
error('Heterogeneous-block residuals are too big'); |
| 67 |
end |
| 68 |
|
| 69 |
heterogeneity_simulate; |