02.09.2015 Views

NUMERICAL DYNAMIC PROGRAMMING

NUMERICAL DYNAMIC PROGRAMMING - Math Tube

NUMERICAL DYNAMIC PROGRAMMING - Math Tube

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>NUMERICAL</strong> <strong>DYNAMIC</strong> <strong>PROGRAMMING</strong><br />

Kenneth L. Judd<br />

Hoover Institution and NBER<br />

June 28, 2006<br />

1


Dynamic Programming<br />

• Foundation of dynamic economic modelling<br />

— Individual decisionmaking<br />

— Social planners problems, Pareto efficiency<br />

— Dynamic games<br />

• Computational considerations<br />

— Applies a wide range of numerical methods: Optimization, approximation, integration<br />

— Can exploit any architecture, including high-power and high-throughput computing<br />

Outline<br />

• Review of Dynamic Programming<br />

• Necessary Numerical Techniques<br />

— Approximation<br />

— Integration<br />

• Numerical Dynamic Programming<br />

2


Discrete-Time Dynamic Programming<br />

• Objective:<br />

E<br />

( TX<br />

t=1<br />

π(x t ,u t ,t)+W (x T +1 )<br />

)<br />

, (12.1.1)<br />

— X is set of states and D is the set of controls<br />

— π(x, u, t) payoffs inperiodt, forx ∈ X at the beginning of period t, andcontrolu ∈ D is<br />

applied in period t.<br />

— D(x, t) ⊆ D: controls which are feasible in state x at time t.<br />

— F (A; x, u, t) :probability that x t+1 ∈ A ⊂ X conditional on time t control and state<br />

• Value function definition<br />

( TX<br />

V (x, t) ≡ sup E<br />

U(x,t) s=t<br />

π(x s ,u s ,s)+W (x T +1 )|x t = x<br />

)<br />

. (12.1.2)<br />

• Bellman equation<br />

V (x, t) =<br />

sup<br />

u∈D(x,t)<br />

π(x, u, t)+E {V (x t+1 ,t+1)|x t = x, u t = u} (12.1.3)<br />

• Existence: boundedness of π is sufficient<br />

3


Autonomous, Infinite-Horizon Problem:<br />

• Objective:<br />

max<br />

u t<br />

( ∞<br />

)<br />

X<br />

E β t π(x t ,u t )<br />

t=1<br />

(12.1.1)<br />

• Value function definition: if U(x) is set of all feasible strategies starting at x.<br />

( ∞ )<br />

X<br />

V (x) ≡ sup E β t π(x t ,u t )<br />

U(x)<br />

¯ x0 = x , (12.1.8)<br />

• Bellman equation for V (x)<br />

t=0<br />

V (x) = sup<br />

u∈D(x)<br />

π(x, u)+βE © V (x + )|x, u ª ≡ (TV)(x), (12.1.9)<br />

• Optimal policy function, U(x), ifitexists,isdefined by<br />

U(x) ∈ arg max π(x, u)+βE© V (x + )|x, u ª<br />

u∈D(x)<br />

• Standard existence theorem: If X is compact, β


Deterministic Growth Example<br />

• Problem:<br />

— Euler equation:<br />

V (k 0 )=max ct<br />

P ∞<br />

t=0 βt u(c t ),<br />

k t+1 = F (k t ) − c t<br />

k 0 given<br />

u 0 (c t )=βu 0 (c t+1 )F 0 (k t+1 )<br />

(12.1.12)<br />

— Bellman equation<br />

V (k) =max u(c)+βV (F (k) − c). (12.1.13)<br />

c<br />

— Solution to (12.1.12) is a policy function C(k) and a value function V (k) satisfying<br />

0=u 0 (C(k))F 0 (k) − V 0 (k) (12.1.15)<br />

V (k)=u(C(k)) + βV (F (k) − C(k)) (12.1.16)<br />

• (12.1.16) defines the value of an arbitrary policy function C(k), not just for the optimal C(k).<br />

• The pair (12.1.15) and (12.1.16)<br />

— expresses the value function given a policy, and<br />

— a first-order condition for optimality.<br />

5


Stochastic Growth Accumulation<br />

• Problem:<br />

( ∞<br />

X<br />

)<br />

V (k, θ) =max<br />

c t , t<br />

E<br />

t=0<br />

β t u(c t )<br />

k t+1 = F (k t ,θ t ) − c t<br />

θ t+1 = g(θ t ,ε t )<br />

ε t : i.i.d. random variable<br />

k 0 = k, θ 0 = θ.<br />

• State variables:<br />

— k: productive capital stock, endogenous<br />

— θ: productivity state, exogenous<br />

• The dynamic programming formulation is<br />

V (k, θ) =max<br />

c<br />

u(c)+βE{V (F (k, θ) − c, θ + )|θ} (12.1.21)<br />

θ + = g(θ, ε)<br />

• The control law c = C(k, θ) satisfies the first-order conditions<br />

0=u c (C(k, θ)) − βE{u c (C(k + ,θ + ))F k (k + ,θ + ) | θ}, (12.1.23)<br />

where<br />

k + ≡ F (k, L(k, θ),θ) − C(k, θ),<br />

6


Discrete State Space Problems<br />

• State space X = {x i ,i=1, ··· ,n}<br />

• Controls D = {u i |i =1, ..., m}<br />

• qij t (u) =Pr(x t+1 = x j |x t = x i ,u t = u)<br />

• Q t (u) = ¡ qij t (u)¢ : Markov transition matrix at t if u i,j t = u.<br />

Value Function Iteration: Discrete-State Problems<br />

• State space X = {x i ,i=1, ··· ,n} and controls D = {u i |i =1, ..., m}<br />

• Terminal value:<br />

V T +1<br />

i<br />

= W (x i ),i=1, ··· ,n.<br />

• Bellman equation: time t value function is<br />

V t<br />

i<br />

=max<br />

u<br />

[π(x i ,u,t)+β<br />

nX<br />

j=1<br />

q t ij(u) V t+1<br />

j ], i=1, ··· ,n<br />

• Bellman equation can be directly implemented - called value function iteration. Only choice for<br />

finite T .<br />

7


• Infinite-horizon problems<br />

— Bellman equation is now a simultaneous set of equations for V i values:<br />

⎡<br />

⎤<br />

nX<br />

V i =max ⎣π(x i ,u)+β q ij (u) V j<br />

⎦ ,i=1, ··· ,n<br />

u<br />

— Value function iteration is<br />

V k+1<br />

i<br />

U k+1<br />

i<br />

=max<br />

u<br />

⎡<br />

=argmax<br />

u<br />

⎣π(x i ,u)+β<br />

⎡<br />

j=1<br />

nX<br />

j=1<br />

⎣π(x i ,u)+β<br />

q ij (u) V k<br />

j<br />

nX<br />

j=1<br />

— Can use value function iteration with arbitrary V 0<br />

i<br />

— Error is given by contraction mapping property:<br />

°<br />

°V k − V ∗° ° ≤ 1<br />

1 − β<br />

⎤<br />

q ij (u) V k<br />

j<br />

⎦ ,i=1, ··· ,n<br />

⎤<br />

⎦ ,i=1, ··· ,n<br />

and iterate k →∞.<br />

°<br />

°V k+1 − V k° °<br />

— Stopping rule: continue until ° °V k − V ∗° °


Policy Iteration (a.k.a. Howard improvement)<br />

• Value function iteration is a slow process<br />

— Linear convergence at rate β<br />

— Convergence is particularly slow if β is close to 1.<br />

• Policy iteration is faster<br />

— Current guess:<br />

V k<br />

i ,i=1, ··· ,n.<br />

— Iteration: compute optimal policy today if V k is value tomorrow:<br />

⎡<br />

⎤<br />

nX<br />

Ui<br />

k+1 =argmax ⎣π(x i ,u)+β q ij (u) Vj<br />

k ⎦ ,i=1, ··· ,n,<br />

u<br />

— Compute the value function if the policy U k+1 is used forever, which is solution to the linear<br />

system<br />

Vi k+1 = π ¡ ¢<br />

nX<br />

x i ,Ui<br />

k+1 + β q ij (Ui k+1 ) Vj<br />

k+1 ,i=1, ··· ,n,<br />

j=1<br />

— Policy iteration depends on only monotonicity<br />

∗ If initial guess is above or below solution then policy iteration is between truth and value<br />

function iterate<br />

∗ Works well even for β close to 1.<br />

9<br />

j=1


Linear Programming Approach<br />

• If D is finite, we can reformulate dynamic programming as a linear programming problem.<br />

• (12.3.4) is equivalent to the linear program<br />

P<br />

min n<br />

Vi i=1 V i<br />

s.t. V i ≥ π(x i ,u)+β P n<br />

j=1 q ij(u)V j , ∀i, u ∈ D,<br />

• Computational considerations<br />

(12.4.10)<br />

— (12.4.10) may be a large problem<br />

— Trick and Zin (1997) pursued an acceleration approach with success.<br />

— Recent work by Daniela Pucci de Farias and Ben van Roy has revived interest.<br />

Continuous states: Discretization<br />

• Method:<br />

— “Replace” continuous X with a finite X ∗ = {x i ,i=1, ··· ,n} ⊂ X<br />

— Proceedwithafinite-state method.<br />

• Problems:<br />

— Sometimes need to alter space of controls to assure landing on an x in X.<br />

— A fine discretization often necessary to get accurate approximations<br />

10


Continuous Methods for Continuous-State Problems<br />

• Basic Bellman equation:<br />

V (x) = max<br />

u∈D(x) π(u, x)+βE{V (x+ )|x, u)} ≡ (TV)(x). (12.7.1)<br />

— Discretization essentially approximates V withastepfunction<br />

— Approximation theory provides better methods to approximate continuous functions.<br />

• General Task<br />

— Choose a finite-dimensional parameterization<br />

V (x) . = ˆV (x; a), a∈ R m (12.7.2)<br />

and a finite number of states<br />

X = {x 1 ,x 2 , ··· ,x n }, (12.7.3)<br />

— Find coefficients a ∈ R m such that ˆV (x; a) “approximately” satisfies the Bellman equation.<br />

11


General Parametric Approach: Approximating T<br />

• For each x j , (TV)(x j ) is defined by<br />

v j =(TV)(x j )= max<br />

u∈D(x j ) π(u, x j)+β<br />

Z<br />

ˆV (x + ; a)dF (x + |x j ,u) (12.7.5)<br />

• In practice, we compute the approximation ˆT<br />

v j =(ˆTV)(x j ) . =(TV)(x j )<br />

— Integration step: for ω j and x j for some numerical quadrature formula<br />

Z<br />

E{V (x + ; a)|x j ,u)}= ˆV (x + ; a)dF (x + |x j ,u)<br />

Z<br />

= ˆV (g(x j ,u,ε); a)dF (ε)<br />

.<br />

= X ω ˆV (g(x j ,u,ε ); a)<br />

<br />

— Maximization step: for x i ∈ X, evaluate<br />

— Fitting step:<br />

v i =(T ˆV )(x i )<br />

∗ Data: (v i ,x i ),i=1, ··· ,n<br />

∗ Objective: find an a ∈ R m such that ˆV (x; a) best fits the data<br />

∗ Methods: determined by ˆV (x; a)<br />

12


Approximation Methods<br />

• General Objective: Given data about f(x) construct simpler g(x) approximating f(x).<br />

• Questions:<br />

— What data should be produced and used?<br />

— What family of “simpler” functions should be used?<br />

— What notion of approximation do we use?<br />

• Comparisons with statistical regression<br />

— Both approximate an unknown function and use a finite amount of data<br />

— Statistical data is noisy but we assume data errors are small<br />

— Nature produces data for statistical analysis but we produce the data in function approximation<br />

13


Interpolation Methods<br />

• Interpolation: find g (x) from an n-D family of functions to exactly fit n data items<br />

• Lagrange polynomial interpolation<br />

— Data: (x i ,y i ) ,i=1, .., n.<br />

— Objective: Find a polynomial of degree n − 1, p n (x), which agrees with the data, i.e.,<br />

y i = f(x i ),i=1, .., n<br />

— Result: If the x i are distinct, there is a unique interpolating polynomial<br />

• Does p n (x) converge to f (x) as we use more points? Consider f(x) = 1<br />

1+x 2 ,x i uniform on [−5, 5]<br />

Figure 1:<br />

14


• Hermite polynomial interpolation<br />

— Data: (x i ,y i ,y 0 i) ,i=1, .., n.<br />

— Objective: Find a polynomial of degree 2n − 1, p(x), which agrees with the data, i.e.,<br />

y i =p(x i ),i=1, .., n<br />

yi 0 =p 0 (x i ),i=1, .., n<br />

— Result: If the x i are distinct, there is a unique interpolating polynomial<br />

• Least squares approximation<br />

— Data: A function, f(x).<br />

— Objective: Find a function g(x) from a class G that best approximates f(x), i.e.,<br />

g =argmax<br />

g∈G<br />

kf − gk2<br />

15


Orthogonal polynomials<br />

• General orthogonal polynomials<br />

— Space: polynomials over domain D<br />

— weighting function: w(x) > 0<br />

— Inner product: hf,gi = R D f(x)g(x)w(x)dx<br />

— Definition: {φ i } is a family of orthogonal polynomials w.r.t w (x) iff<br />

­<br />

φi ,φ j<br />

® =0,i6= j<br />

— We like to compute orthogonal polynomials using recurrence formulas<br />

φ 0 (x)=1<br />

φ 1 (x)=x<br />

φ k+1 (x)=(a k+1 x + b k ) φ k (x)+c k+1 φ k−1 (x)<br />

16


• Chebyshev polynomials<br />

— [a, b] =[−1, 1] and w(x) = ¡ 1 − x 2¢ −1/2<br />

— T n (x) =cos(n cos −1 x)<br />

T 0 (x) =1<br />

T 1 (x) =x<br />

T n+1 (x) =2xT n (x) − T n−1 (x),<br />

• General Orthogonal Polynomials<br />

— Few problems have the specific intervals and weights used in definitions<br />

— One must adapt interval through linear COV: If compact interval [a, b] is mapped to [−1, 1] by<br />

y = −1+2 x − a<br />

b − a<br />

¡ ¢ ¡<br />

then φ i −1+2<br />

x−a<br />

b−a are orthogonal over x ∈ [a, b] with respect to w −1+2<br />

x−a<br />

b−a¢<br />

iff φi (y) are<br />

orthogonal over y ∈ [−1, 1] w.r.t. w (y)<br />

17


Regression<br />

• Data: (x i ,y i ) ,i=1, .., n.<br />

• Objective: Find a function f(x; β) with β ∈ R m .<br />

, m ≤ n, with y i = f(xi ),i=1, .., n.<br />

• Least Squares regression:<br />

Chebyshev Regression<br />

• Chebyshev Regression Data:<br />

X<br />

min (yi − f (x i ; β)) 2<br />

β∈R m<br />

• (x i ,y i ) ,i=1, .., n > m, x i are the n zeroes of T n (x) adapted to [a, b]<br />

• Chebyshev Interpolation Data:<br />

(x i ,y i ) ,i=1, .., n = m, x i are the n zeroes of T n (x)adapted to [a, b]<br />

18


Algorithm 6.4: Chebyshev Approximation Algorithm in R 1<br />

• Objective: Given f(x) defined on [a, b], find its Chebyshev polynomial approximation p(x)<br />

• Step 1: Compute the m ≥ n +1Chebyshev interpolation nodes on [−1, 1]:<br />

µ 2k − 1<br />

z k = −cos<br />

2m π ,k=1, ··· ,m.<br />

• Step 2: Adjust nodes to [a, b] interval:<br />

µ b − a<br />

x k =(z k +1) + a, k =1, ..., m.<br />

2<br />

• Step 3: Evaluate f at approximation nodes:<br />

w k = f(x k ) ,k=1, ··· ,m.<br />

• Step 4: Compute Chebyshev coefficients, a i ,i=0, ··· ,n:<br />

P m<br />

k=1<br />

a i =<br />

w kT i (z k )<br />

P m<br />

k=1 T i(z k ) 2<br />

to arrive at approximation of f(x, y) on [a, b]:<br />

nX<br />

µ<br />

p(x) = a i T i 2 x − a <br />

b − a − 1<br />

i=0<br />

19


Minmax Approximation<br />

• Data: (x i ,y i ) ,i=1, .., n.<br />

• Objective: L ∞ fit<br />

• Problem: Difficult to compute<br />

min max<br />

β∈R m i<br />

ky i − f (x i ; β)k<br />

• Chebyshevminmaxproperty<br />

Theorem 1 Suppose f :[−1, 1] → R is C k for some k ≥ 1, andletI n be the degree n polynomial<br />

interpolation of f based at the zeroes of T n (x). Then<br />

µ <br />

2<br />

k f − I n k ∞ ≤<br />

π log(n +1)+1<br />

• Chebyshev interpolation:<br />

×<br />

(n − k)!<br />

n!<br />

³ µ π<br />

´k b − a k<br />

k f (k) k ∞<br />

2 2<br />

— converges in L ∞<br />

— essentially achieves minmax approximation<br />

— easy to compute<br />

— does not approximate f 0 20


Splines<br />

Definition 2 Afunctions(x) on [a, b] is a spline of order n iff<br />

1. s is C n−2 on [a, b], and<br />

2. there is a grid of points (called nodes) a = x 0


• Conditions:<br />

— 2n interpolation and continuity conditions:<br />

y i =a i + b i x i + c i x 2 i + d i x 3 i ,<br />

i =1,.,n<br />

y i =a i+1 + b i+1 x i + c i+1 x 2 i + d i+1 x 3 i ,<br />

i =0,.,n− 1<br />

— 2n − 2 conditions from C 2 at the interior: for i =1, ···n − 1,<br />

b i +2c i x i +3d i x 2 i =b i+1 +2c i+1 x i +3d i+1 x 2 i<br />

2c i +6d i x i =2c i+1 +6d i+1 x i<br />

— Equations (1—4) are 4n − 2 linear equations in 4n unknown parameters, a, b, c, and d.<br />

— construct 2 side conditions:<br />

∗ natural spline: s 0 (x 0 )=0=s 0 (x n ); it minimizes total curvature, R x n<br />

x 0<br />

s 00 (x) 2 dx, among<br />

solutions to (1-4).<br />

∗ Hermite spline: s 0 (x 0 )=y0 0 and s 0 (x n )=yn 0 (assumes extra data)<br />

∗ Secant Hermite spline: s 0 (x 0 )=(s(x 1 )−s(x 0 ))/(x 1 −x 0 ) and s 0 (x n )=(s(x n )−s(x n−1 ))/(x n −<br />

x n−1 ).<br />

∗ not-a-knot: choosej = i 1 ,i 2 , such that i 1 +1


• Shape-preservation<br />

— Concave (monotone) data may lead to nonconcave (nonmonotone) approximations.<br />

— Example<br />

• Schumaker Procedure:<br />

1. Take level (and maybe slope) data at nodes x i<br />

2. Add intermediate nodes z + i ∈ [x i ,x i+1 ]<br />

3. Run quadratic spline with nodes at the x and z nodes which intepolate data and preserves<br />

shape.<br />

4. Schumaker formulas tell one how to choose the z and spline coefficients (see book and correction<br />

at book’s website)<br />

• Many other procedures exist for one-dimensional problems, but few procedures exist for twodimensional<br />

problems<br />

23


• Spline summary:<br />

— Evaluation is cheap<br />

∗ Splines are locally low-order polynomial.<br />

∗ Can choose intervals so that finding which [x i ,x i+1 ] contains a specific x is easy.<br />

∗ Finding enclosing interval for general x i sequence requires at most dlog 2 ne comparisons<br />

— Good fits even for functions with discontinuous or large higher-order derivatives. E.g., quality<br />

of cubic splines depends only on f (4) (x), not f (5) (x).<br />

— Can use splines to preserve shape conditions<br />

24


Multidimensional approximation methods<br />

• Lagrange Interpolation<br />

— Data: D ≡ {(x i ,z i )} N i=1 ⊂ Rn+m ,wherex i ∈ R n and z i ∈ R m<br />

— Objective: find f : R n → R m such that z i = f(x i ).<br />

— Need to choose nodes carefully.<br />

— Task: Find combinations of interpolation nodes and spanning functions to produce a nonsingular<br />

(well-conditioned) interpolation matrix.<br />

25


Tensor products<br />

• General Approach:<br />

— If A and B are sets of functions over x ∈ R n , y ∈ R m , their tensor product is<br />

A ⊗ B = {ϕ(x)ψ(y) | ϕ ∈ A, ψ ∈ B}.<br />

— Given a basis for functions of x i , Φ i = {ϕ i k (x i)} ∞ k=0 , the n-fold tensor product basis for functions<br />

of (x 1 ,x 2 ,...,x n ) is<br />

( nY<br />

)<br />

Φ = ϕ i k i<br />

(x i ) | k i =0, 1, ··· ,i=1,...,n<br />

i=1<br />

• Orthogonal polynomials and Least-square approximation<br />

— Suppose Φ i are orthogonal with respect to w i (x i ) over [a i ,b i ]<br />

— Least squares approximation of f(x 1 , ··· ,x n ) in Φ is<br />

X hϕ, fi<br />

hϕ, ϕi ϕ,<br />

where the product weighting function<br />

defines h·, ·i over D = Q i [a i,b i ] in<br />

ϕ∈Φ<br />

W (x 1 ,x 2 , ··· ,x n )=<br />

hf(x),g(x)i =<br />

Z<br />

D<br />

nY<br />

i=1<br />

w i (x i )<br />

f(x)g(x)W (x)dx.<br />

26


Algorithm 6.4: Chebyshev Approximation Algorithm in R 2<br />

• Objective: Given f(x, y) defined on [a, b] × [c, d], find its Chebyshev polynomial approximation<br />

p(x, y)<br />

• Step 1: Compute the m ≥ n +1Chebyshev interpolation nodes on [−1, 1]:<br />

µ 2k − 1<br />

z k = −cos<br />

2m π ,k=1, ··· ,m.<br />

• Step 2: Adjust nodes to [a, b] and [c, d] intervals:<br />

µ b − a<br />

x k =(z k +1) + a, k =1, ..., m.<br />

2<br />

µ d − c<br />

y k =(z k +1) + c, k =1, ..., m.<br />

2<br />

• Step 3: Evaluate f at approximation nodes:<br />

w k, = f(x k ,y ) ,k=1, ··· ,m. , =1, ··· ,m.<br />

• Step 4: Compute Chebyshev coefficients, a ij ,i,j =0, ··· ,n:<br />

P m P m<br />

k=1 =1<br />

a ij =<br />

w k,T i (z k )T j (z )<br />

( P m<br />

k=1 T i(z k ) 2 )( P m<br />

=1 T j(z ) 2 )<br />

to arrive at approximation of f(x, y) on [a, b] × [c, d]:<br />

nX nX<br />

µ<br />

p(x, y) = a ij T i 2 x − a µ<br />

b − a − 1 T j 2 y − c <br />

d − c − 1<br />

i=0<br />

j=0<br />

27


Multidimensional Splines<br />

• B-splines: Multidimensional versions of splines can be constructed through tensor products; here<br />

B-splines would be useful.<br />

• Summary<br />

— Tensor products directly extend one-dimensional methods to n dimensions<br />

— Curse of dimensionality often makes tensor products impractical<br />

Complete polynomials<br />

• Taylor’s theorem for R n produces the approximation<br />

f(x) . =f(x 0 )+ P n<br />

i=1<br />

+ 1 2<br />

P n<br />

i 1 =1<br />

P n<br />

i 2 =1<br />

∂f<br />

∂x i<br />

(x 0 )(x i − x 0 i )<br />

∂ 2 f<br />

∂x i1 ∂x ik<br />

(x 0 )(x i1 − x 0 i 1<br />

)(x ik − x 0 i k<br />

)+...<br />

— For k =1, Taylor’s theorem for n dimensions used the linear functions P1 n ≡ {1,x 1 ,x 2 , ··· ,x n }<br />

— For k =2, Taylor’s theorem uses P2 n ≡ P1 n ∪ {x 2 1, ··· ,x 2 n,x 1 x 2 ,x 1 x 3 , ··· ,x n−1 x n }.<br />

• In general, the kth degree expansion uses the complete set of polynomials of total degree k in n<br />

variables.<br />

nX<br />

Pk n ≡ {x i 1<br />

1 ···x i n n | i ≤ k, 0 ≤ i 1 , ··· ,i n }<br />

=1<br />

28


• Complete orthogonal basis includes only terms with total degree k or less.<br />

• Sizes of alternative bases<br />

degree k Pk n Tensor Prod.<br />

2 1+n + n(n +1)/2 3 n<br />

3 1+n + n(n+1)<br />

2<br />

+ n 2 + n(n−1)(n−2)<br />

6<br />

4 n<br />

— Complete polynomial bases contains fewer elements than tensor products.<br />

— Asymptotically, complete polynomial bases are as good as tensor products.<br />

— For smooth n-dimensional functions, complete polynomials are more efficient approximations<br />

• Construction<br />

— Compute tensor product approximation, as in Algorithm 6.4<br />

— Drop terms not in complete polynomial basis (or, just compute coefficients for polynomials in<br />

complete basis).<br />

— Complete polynomial version is faster to compute since it involves fewer terms<br />

29


Integration<br />

• Most integrals cannot be evaluated analytically<br />

• Integrals frequently arise in economics<br />

— Expected utility and discounted utility and profits over a long horizon<br />

— Bayesian posterior<br />

— Solution methods for dynamic economic models<br />

Gaussian Formulas<br />

• All integration formulas choose quadrature nodes x i ∈ [a, b] and quadrature weights ω i :<br />

Z b<br />

f(x) dx =<br />

. nX<br />

ω i f(x i ) (7.2.1)<br />

a<br />

— Newton-Cotes (trapezoid, Simpson, etc.) use arbitrary x i<br />

— Gaussian quadrature uses good choices of x i nodes and ω i weights.<br />

• Exact quadrature formulas:<br />

— Let F k bethespaceofdegreek polynomials<br />

— A quadrature formula is exact of degree k if it correctly integrates each function in F k<br />

— Gaussian quadrature formulas use n points and are exact of degree 2n − 1<br />

i=1<br />

30


Theorem 3 Suppose that {ϕ k (x)} ∞ k=0<br />

is an orthonormal family of polynomials with respect to w(x)<br />

on [a, b]. Then there are x i nodes and weights ω i such that a


Gauss-Chebyshev Quadrature<br />

• Domain: [−1, 1]<br />

• Weight: (1 − x 2 ) −1/2<br />

• Formula: Z 1<br />

f(x)(1 − x 2 ) −1/2 dx = π<br />

−1 n<br />

for some ξ ∈ [−1, 1], with quadrature nodes<br />

Arbitrary Domains<br />

• Want to approximate R b<br />

a<br />

x i = cos<br />

nX<br />

f(x i )+<br />

i=1<br />

π f (2n) (ξ)<br />

2 2n−1 (2n)!<br />

(7.2.4)<br />

µ 2i − 1<br />

2n π <br />

, i =1, ..., n. (7.2.5)<br />

f(x) dx for different range, and/or no weight function<br />

— Linear change of variables x = −1+2(y − a)(b − a)<br />

— Multiply the integrand by (1 − x 2 ) ± 1/2 (1 − x 2 ) 1/2 .<br />

Z b<br />

f(y) dy = b − a Z 1<br />

µ (x +1)(b − a)<br />

f<br />

2<br />

2<br />

a<br />

−1<br />

¡ ¢ 1 − x<br />

2 1/2<br />

+ a<br />

dx<br />

(1 − x 2 1/2<br />

)<br />

— Gauss-Chebyshev quadrature uses the x i Gauss-Chebyshev nodes over [−1, 1]<br />

Z b<br />

f(y) dy = . π(b − a)<br />

nX<br />

µ (xi +1)(b − a) ¡1 ¢<br />

f<br />

+ a − x<br />

2 1/2<br />

2n<br />

2<br />

i<br />

a<br />

i=1<br />

32


Gauss-Hermite Quadrature<br />

• Domain is [−∞, ∞] and weight is e −x2<br />

• Formula: for some ξ ∈ (−∞, ∞).<br />

Z ∞<br />

−∞<br />

f(x)e −x2 dx =<br />

nX<br />

i=1<br />

ω i f(x i )+ n!√ π<br />

· f (2n) (ξ)<br />

2 n (2n)!<br />

N x i ω i<br />

2 0.7071067811 0.8862269254<br />

3 0.1224744871(1) 0.2954089751<br />

0.0000000000 0.1181635900(1)<br />

N x i ω i<br />

7 0.2651961356(1) 0.9717812450(−3)<br />

0.1673551628(1) 0.5451558281(−1)<br />

0.8162878828 0.4256072526<br />

0.0000000000 0.8102646175<br />

• Normal Random Variables<br />

— Y is distributed N(µ, σ 2 ). Expectation is integration.<br />

— Use Gauss-Hermite quadrature: Linear COV x =(y − µ)/ √ 2 σ implies<br />

E{f(Y )}=<br />

Z ∞<br />

−∞<br />

.<br />

=π −1 2<br />

f(y)e −(y−µ)2 /(2σ 2) dy =<br />

nX<br />

ω i f( √ 2 σx i + µ)<br />

i=1<br />

Z ∞<br />

−∞<br />

f( √ 2 σx+ µ)e −x2 √<br />

2 σdx<br />

where the ω i and x i are the Gauss-Hermite quadrature weights and nodes over [−∞, ∞].<br />

33


Multidimensional Integration<br />

• Most economic problems have several dimensions<br />

— Multiple assets<br />

— Multiple error terms<br />

• Multidimensional integrals are much more difficult<br />

— Simple methods suffer from curse of dimensionality<br />

— There are methods which avoid curse of dimensionality<br />

34


Product Rules<br />

• Build product rules from one-dimension rules<br />

• Let x i,ω i, i =1, ··· ,m, be one-dimensional quadrature points and weights in dimension from<br />

a Newton-Cotes rule or the Gauss-Legendre rule.<br />

• The product rule<br />

Z<br />

[−1,1] d f(x)dx . =<br />

mX mX<br />

···<br />

i 1 =1 i d =1<br />

ω 1 i 1<br />

ω 2 i 2 ···ω d i d<br />

f(x 1 i 1<br />

,x 2 i 2<br />

, ··· ,x d i d<br />

)<br />

• Gaussian structure prevails<br />

— Suppose w (x) is weighting function in dimension <br />

— Define the d-dimensional weighting function.<br />

dY<br />

W (x) ≡ W (x 1 , ··· ,x d )= w (x )<br />

— Product Gaussian rules are based on product orthogonal polynomials.<br />

• Curse of dimensionality:<br />

— m d functional evaluations is m d for a d-dimensional problem with m points in each direction.<br />

— Problem worse for Newton-Cotes rules which are less accurate in R 1 .<br />

=1<br />

35


General Parametric Approach: Approximating T<br />

• For each x j , (TV)(x j ) is defined by<br />

v j =(TV)(x j )= max<br />

u∈D(x j ) π(u, x j)+β<br />

Z<br />

ˆV (x + ; a)dF (x + |x j ,u) (12.7.5)<br />

• In practice, we compute the approximation ˆT<br />

v j =(ˆTV)(x j ) . =(TV)(x j )<br />

— Integration step: for ω j and x j for some numerical quadrature formula<br />

Z<br />

E{V (x + ; a)|x j ,u)}= ˆV (x + ; a)dF (x + |x j ,u)<br />

Z<br />

= ˆV (g(x j ,u,ε); a)dF (ε)<br />

.<br />

= X ω ˆV (g(x j ,u,ε ); a)<br />

<br />

— Maximization step: for x i ∈ X, evaluate<br />

v i =(T ˆV )(x i )<br />

∗ Hot starts<br />

∗ Concave stopping rules<br />

— Fitting step:<br />

∗ Data: (v i ,x i ),i=1, ··· ,n<br />

∗ Objective: find an a ∈ R m such that ˆV (x; a) best fits the data<br />

∗ Methods: determined by ˆV (x; a)<br />

36


Approximating T with Hermite Data<br />

• Conventional methods just generate data on V (x j ):<br />

Z<br />

v j = max π(u, x j)+β ˆV (x + ; a)dF (x + |x j ,u) (12.7.5)<br />

u∈D(x j )<br />

• Envelope theorem:<br />

— If solution u is interior,<br />

Z<br />

vj 0 = π x (u, x j )+β<br />

ˆV (x + ; a)dF x (x + |x j ,u)<br />

— If solution u is on boundary<br />

Z<br />

vj 0 = µ + π x (u, x j )+β<br />

ˆV (x + ; a)dF x (x + |x j ,u)<br />

where µ is a Kuhn-Tucker multiplier<br />

• Since computing vj 0 is cheap, we should include it in data:<br />

— Data: (v i ,vi 0,x i), i=1, ··· ,n<br />

— Objective: find an a ∈ R m such that ˆV (x; a) best fits Hermite data<br />

— Methods: determined by ˆV (x; a)<br />

37


General Parametric Approach: Value Function Iteration<br />

• Comparison with discretization<br />

guess a−→ ˆV (x; a)<br />

−→ (v i ,x i ),i=1, ··· ,n<br />

−→ new a<br />

— This procedure examines only a finite number of points, but does not assume that future points<br />

lie in same finite set.<br />

— Our choices for the x i are guided by systematic numerical considerations.<br />

• Synergies<br />

— Smooth interpolation schemes allow us to use Newton’s method in the maximization step.<br />

— They also make it easier to evaluate the integral in (12.7.5).<br />

• Finite-horizon problems<br />

— Value function iteration is only possible procedure since V (x, t) depends on time t.<br />

— Begin with terminal value function, V (x, T )<br />

— Compute approximations for each V (x, t), t = T − 1,T − 2, etc.<br />

38


Algorithm 12.5: Parametric Dynamic Programming<br />

with Value Function Iteration<br />

Objective: Solve the Bellman equation, (12.7.1).<br />

Step 0: Choose functional form for ˆV (x; a), and choose<br />

the approximation grid, X = {x 1 , ..., x n }.<br />

Make initial guess ˆV (x; a 0 ), and choose stopping<br />

criterion >0.<br />

Step 1: Maximization step: Compute<br />

v j =(T ˆV (·; a i ))(x j ) for all x j ∈ X.<br />

Step 2: Fitting step: Using the appropriate approximation<br />

method, compute the a i+1 ∈ R m such that<br />

ˆV (x; a i+1 ) approximates the (v i ,x i ) data.<br />

Step 3: If k ˆV (x; a i ) − ˆV (x; a i+1 ) k< , STOP; else go to step 1.<br />

39


• Convergence<br />

— T is a contraction mapping<br />

— ˆT may be neither monotonic nor a contraction<br />

• Shape problems<br />

— An instructive example<br />

Figure 2:<br />

— Shape problems may become worse with value function iteration<br />

— Shape-preserving approximation will avoid these instabilities<br />

40


Summary:<br />

• Discretization methods<br />

— Easy to implement<br />

— Numerically stable<br />

— Amenable to many accelerations<br />

— Poor approximation to continuous problems<br />

• Continuous approximation methods<br />

— Can exploit smoothness in problems<br />

— Possible numerical instabilities<br />

— Acceleration is less possible<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!