Professional Documents
Culture Documents
in Continuous Time, II
ECO 235: Advanced Macroeconomics
Benjamin Moll
Princeton
Stanford
February 12, 2014
1 / 74
macroeconomy?
better way (IMHO) of doing Krusell and Smith (1998)
2 / 74
3 / 74
Functional forms
c 1
, F (k) = k
1
Use finite difference method. MATLAB code HJB_NGM.m
U(c) =
Shorthand notation
Vi = V (ki )
4 / 74
Vi Vi 1
= Vi,B
k
Vi +1 Vi
V (ki )
= Vi,F
k
Vi +1 Vi 1
V (ki )
= Vi,C
2k
V (ki )
backward difference
forward difference
central difference
5 / 74
!#%$
!#$
Central
#$
#%$
"
6 / 74
FD approximation to HJB is
Vi = U(ci ) + Vi [F (ki ) ki ci ]
()
7 / 74
Which FD Approximation?
Which of these you use it extremely important
8 / 74
Iterative Method
Idea: Solve FOC for given V n , update V n+1 according to
Vin+1 Vin
+ Vin = U(cin ) + (V n ) (ki )[F (ki ) ki cin ] ()
http://www.princeton.edu/~moll/HACTproject/HJB_NGM.m
Important parameter: = step size, cannot be too large
(CFL condition).
9 / 74
Convergence
10 / 74
Vin+1 Vin
+ Vin+1 = U(cin ) + (Vin+1 ) (ki )[F (ki ) ki cin ]
( +
1
)I
An V n+1 = U(c n ) +
1 n
V
condition: V (k ) = U (c )
V (ki ) = U (c ),
ki = k
Vi +1 Vi
, ki < k
V (ki ) =
k
Vi Vi 1
, ki > k
V (ki ) =
k
But we did it without having to actually calculate steady
state (never use F (k ) = + equation). Code chooses
steady state by itself.
Upwind magic much more general: works for all stochastic
12 / 74
non-differentiable PDEs
Important for our purposes: uniqueness property
typically, viscosity solution = nice, concave solution.
Definition doesnt blow up, no convex kinks
13 / 74
non-differentiable PDEs
Important for our purposes: uniqueness property
typically, viscosity solution = nice, concave solution.
Definition doesnt blow up, no convex kinks
14 / 74
15 / 74
boundary conditions?
the MAT 101 way is not the right way to think about HJB
17 / 74
http://www.princeton.edu/~moll/HACTproject.htm
18 / 74
1
)I
An v n+1 = U(c n ) +
1 n
v
AT g = 0.
For details see section 2 of
http://www.princeton.edu/~ moll/HACTproject/numerical_MATLAB.pdf
19 / 74
g1(a)
s2(a)
g2(a)
Savings , s i ( a)
D e ns it ie s , g i ( a)
s1(a)
We alt h, a
We alt h, a
20 / 74
0.6
Savings s(a,z)
0.4
0.2
0
0.2
0.4
0.6
0.8
0
1.5
5
10
15
20
25
Wealth, a
0.5
Productivity, z
21 / 74
22 / 74
Transition Dynamics
movie here
23 / 74
6.5
1.9
1.85
1.8
1.75
GDP, Y(t)
Capital, K(t)
5.5
5
4.5
1.7
1.65
1.6
4
1.55
3.5
1.5
1.45
0
10
15
20
25
30
35
40
45
50
10
15
Years, t
25
30
35
40
45
50
20
25
30
Years, t
35
40
45
50
Years, t
(a) Capital
(b) GDP
1.25
0.11
0.1
Interest Rate, r(t)
1.2
Wage, w(t)
20
1.15
1.1
1.05
0.09
0.08
0.07
0.06
0.05
0.95
0.04
0
10
15
20
25
30
Years, t
(c) Wage
35
40
45
50
10
15
25 / 74
Diffusion Processes
A diffusion is simply a continuous-time Markov process (with
W (t + t) W (t) = t t,
t N(0, 1),
W (0) = 0
W (t) N(0, t)
Continuous time analogue of a discrete time random walk:
Wt+1 = Wt + t ,
t N(0, 1)
26 / 74
27 / 74
Brownian Motion
Can be generalized
E[x(t) x(0)] = t,
dx(t) = dt + dW (t)
xt+1 = t + xt + t ,
t N(0, 1)
28 / 74
29 / 74
W on t)
dx = (x)dt + (x)dW
where and are any non-linear etc etc functions.
This is called a diffusion process
() is called the drift and () the diffusion.
all results can be extended to the case where they depend on
xt+1 = x + (1 )xt + t
That is, we just choose
(x) = (
x x)
and we get a nice stationary process!
This is called an Ornstein-Uhlenbeck process
31 / 74
Ornstein-Uhlenbeck Process
(x) = x(1 x)
33 / 74
Other Examples
Geometric Brownian motion:
dx = xdt + xdW
x [0, ), no stationary distribution:
log x(t) N(( 2 /2)t, 2 t).
Feller square root process (finance: Cox-Ingersoll-Ross)
dx = (
x x)dt + xdW
= 2 x/ 2 ,
= 2 x/ 2
35 / 74
E0
V (x0 ) = max
u(t)t=0
e t h (x (t) , u (t)) dt
1
V (x) = max h(x, u) + V (x)g (x, u) + V (x) 2 (x)
uU
2
(2008)
37 / 74
2 (x) = (x)(x)
(this is a function 2 : Rm Rm Rm )
In vector notation
m
X
i =1
1 XX 2
ij (x)ij V (x)
i V (x)gi (x, u)+
2
i =1 j=1
1
V (x) = max h(x, u)+x V (x)g (x, u)+ tr x V (x) 2 (x)
uU
2
x V (x): gradient of V (dimension m 1)
x V (x): Hessian of V (dimension m m).
38 / 74
(x2 )dW
g (x) =
"
g (x1 , x2 , u)
(x2 )
(x) =
"
(x2 )
1
2 (x2 )
+2 V (x1 , x2 )
(x2 ) + 22 V (x1 , x2 )
2
39 / 74
c(t)t=0
e t U(c(t))dt
subject to
dk = [AF (k) k c]dt
dA = (A)dt + (A)dW
for t 0, k(0) = k0 , A(0) = A0 given.
Here: x1 = k, x2 = A, u = c
h(x, u) = U(u)
g (x, u) = F (x) x u
40 / 74
HJB equation is
1
+ A V (k, A)(A) + AA V (k, A) 2 (A)
2
41 / 74
V (a0 , z0 ) = max
E0
c(t)t=0
e t U(c(t))dt
s.t.
da = [z + ra c]dt
dz = (z)dt + (z)dW
aa
for t 0, a(0) = a0 , z(0) = z0 given.
Here: x1 = k, x2 = z, u = c
h(x, u) = U(u)
g (x, u) = x2 + rx1 u
42 / 74
HJB equation is
1
+ z V (a, z)(z) + zz V (a, z) 2 (z)
2
43 / 74
dz = zdt + zdW
V (a, z) = max U(c) + a V (a, z)[z + ra c]
c
1
+ z V (a, z)z + zz V (a, z) 2 z 2
2
Special Case 2: z is a Feller square root process
dz = (
z z)dt + zdW
V (a, z) = max U(c) + a V (a, z)[z + ra c]
c
1
+ z V (a, z)(
z z) + zz V (a, z) 2 z
2
44 / 74
45 / 74
dx = (x)dt + (x)dW ,
x(0) = x0
models
Example 1: x = wealth
(x) determined by saving behavior and return to investments
(x) by return risk.
microfound later
d
1 d2 2
[(x)f (x)] +
[ (x)f (x)]
dx
2 dx 2
47 / 74
Let x Rm .
As before, define the m m covariance matrix
2 (x) = (x)(x)
The Kolmogorov Forward Equation is
t f (x, t) =
m
X
i =1
1 XX
ij [ij2 (x)f (x, t)]
2
i =1 j=1
48 / 74
1
+ z V (a, z)(z) + zz V (a, z) 2 (z)
2
Denote the optimal saving policy function by
s(a, z) = z + ra c
Then g (a, z, t) solves
1
z [(z)g (a, z, t)] + zz [ 2 (z)g (a, z, t)]
2
49 / 74
50 / 74
What We Do
1
Setup
Continuum of entrepreneurs, heterogeneous in wealth a and
productivity z
E0
e t u(ct )dt
52 / 74
Technologies
Two technologies: productive and unproductive
y = fu (z, A, k) = zAf(k),
(
zAB f(k ),
y = fp (z, A, k) =
0,
k
k < ,
Sources of uncertainty:
z: idiosyncratic shock, diffusion process
A: aggregate shock, two-state Poisson process
53 / 74
Setup
Collateral constraints
k a,
1.
Profit maximization:
Entrepreneurs solve
max E0
{ct }
e t u(ct )dt
j = p, u.
s.t.
Plan
55 / 74
(EQ)
(HJB)
1
+ z v (a, z, t)(z) + zz v (a, z, t) 2 (z) + t v (a, z, t)
2
t g (a, z, t) = a [s(a, z, t)g (a, z, t)] z [(z)g (a, z, t)]
1
+ zz [ 2 (z)g (a, z, t)],
2
s(a, z, t) = (a, z; r (t)) + r (t)a c(a, z, t)
(KFE)
Given initial condition g0 (a, z), the two PDEs (HJB) and (KFE)
together with (EQ) fully characterize equilibrium.
56 / 74
movie here
57 / 74
Wealth,a
Pr
o
du
ct
iv
it
y,
z
Density,g(a,z,t)
58 / 74
Entrepreneurs Problem
1
z [(z)g (a, z)] + zz [ 2 (z)g (a, z)]
2
60 / 74
Monster Bellman
Entrepreneurs problem: recursive formulation
Vi (a, z, g ) = max u(c) + a Vi (a, z, g )[i (a, z, g ) + ri (g )a c]
c
1
+ z Vi (a, z, g )(z) + zz Vi (a, z, g ) 2 (z)
2
+ i [Vj (a, z, g ) Vi (a, z, g )]
Z
Vi (a, z, g )
T [g , si ](a, z)dadz.
+
g (a, z)
Vi /g (a, z): functional derivative of Vi wrt to g at (a, z).
Saving policy function
Example:
5 shocks at times t = 5, 10, 15, 20, 25
25 = 32 histories
62 / 74
20
40
60
80
100
120
140
160
180
200
approximation scheme
but the economics seems robust to me, will bet anyone who
63 / 74
Pr(An+1 = Ai |An = Ai ) = 1 e i
Pr(An+1 = Aj |An = Ai ) = e i
converges to Poisson as 0 and N .
Denote histories by An = (A0 , ..., An ) where An {A , Ah }
Keep track of all
v (a, z, t, An ) and
g (a, z, t, An )
64 / 74
1
+ z v (a, z, t, An )(z) + zz v (a, z, t, An ) 2 (z) + t v (a, z, t, A
2
t g (a, z, t, An ) = a [s(a, z, t, An )g (a, z, t, An )]
1
z [(z)g (a, z, t, An )] + zz [ 2 (z)g (a, z, t, An )]
2
g a, z, tn+1 , An+1 = g a, z, tn+1 , An ,
all An .
Note: uses
1 people forward-looking, form expectations over all branches
2 continuity of g with respect to t (state variable)
65 / 74
The Experiments
Experiment 1: comparison to rep. agent model
two economies: economy with frictions and rep. agent
at t = 0, both in steady state (corresponding to no A shocks)
at t = 10, hit with A shock, compare impulse responses
66 / 74
s.t.
F (K , A) = max AZ (
z )(K (1 (
z )))
z
Z z
1
Z
1
1
1
z 1 (z)dz + B 1
Z (
z)
z 1 (z)dz
0
67 / 74
Parameterization
Functional forms
u(c) =
c 1
,
1
f(k) = k
d log zt = log zt +
dWt
but reflected at z, z 0.
Parameter values
B = 1.8,
= 0.6,
= 0.05,
= 2,
Ah = 1,
a = 0,
= 0.05,
= 0.2,
= 6,
= 2,
z = 0.1
A = 0.95
a = 30,
z = 0.6,
z = 1.4,
T = 100
68 / 74
( a) Pr oduc t ivity, A t
1.01
1
1
0.99
0.99
0.98
0.98
0.97
0.97
0.96
0.96
0.95
Frictionless
with Frictions
0.95
0.94
0
10
20
30
40
Frictionless
with Frictions
0.94
0.93
0
10
20
30
40
Ye ar s
Ye ar s
( c ) GD P, Y t
( d) Int e r e s t Rat e , r t
1.02
0.055
0.05
0.98
0.045
0.96
0.04
0.94
0.92
0
Frictionless
with Frictions
10
20
30
Ye ar s
40
Frictionless
with Frictions
0
10
20
30
40
Ye ar s
69 / 74
movie here
70 / 74
Pr
od
u
ct
iv
it
y,
Density,g(a,z,t)
Year = 10
Wealth,a
71 / 74
Pr
od
u
ct
iv
it
y,
Density,g(a,z,t)
Year = 20
Wealth,a
72 / 74
Pr
od
u
ct
iv
it
y,
Density,g(a,z,t)
Year = 30
Wealth,a
73 / 74
Next Steps
Redistributive policies?
Add workers, occupational choice
Fancier approximation
computations suggest: densities live in relatively
low-dimensional space
project densities on that space
use as state variable in value function
What else?
74 / 74