Numerical Methods in Economics

Similar documents
Orthogonal Polynomials

Numerical integration

1 The Lagrange interpolation formula

Lecture 6: Singular Integrals, Open Quadrature rules, and Gauss Quadrature

Lecture 17. Integration: Gauss Quadrature. David Semeraro. University of Illinois at Urbana-Champaign. March 20, 2014

Orthogonal Polynomials and Least-Squares Approximations to Functions

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

3.4 Numerical integration

Numerical Analysis: Trapezoidal and Simpson s Rule

Numerical Integration. 1 Introduction. 2 Midpoint Rule, Trapezoid Rule, Simpson Rule. AMSC/CMSC 460/466 T. von Petersdorff 1

NUMERICAL INTEGRATION. The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by.

Discrete Least-squares Approximations

Numerical Integration

Best Approximation. Chapter The General Case

Theoretical foundations of Gaussian quadrature

Review of Calculus, cont d

The Regulated and Riemann Integrals

Numerical quadrature based on interpolating functions: A MATLAB implementation

Advanced Computational Fluid Dynamics AA215A Lecture 3 Polynomial Interpolation: Numerical Differentiation and Integration.

Lecture 14: Quadrature

Construction of Gauss Quadrature Rules

1. Gauss-Jacobi quadrature and Legendre polynomials. p(t)w(t)dt, p {p(x 0 ),...p(x n )} p(t)w(t)dt = w k p(x k ),

Continuous Random Variables

Math& 152 Section Integration by Parts

NUMERICAL INTEGRATION

Physics 116C Solution of inhomogeneous ordinary differential equations using Green s functions

63. Representation of functions as power series Consider a power series. ( 1) n x 2n for all 1 < x < 1

Lecture 19: Continuous Least Squares Approximation

Chapter 3 Polynomials

Matrices, Moments and Quadrature, cont d

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

Part IB Numerical Analysis

Abstract inner product spaces

Trapezoidal Rule, n = 1, x 0 = a, x 1 = b, h = b a. f (x)dx = h 2 (f (x 0) + f (x 1 )) h3

New Expansion and Infinite Series

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

8 Laplace s Method and Local Limit Theorems

Main topics for the First Midterm

Chapter 5 : Continuous Random Variables

Interpolation. Gaussian Quadrature. September 25, 2011

Recitation 3: More Applications of the Derivative

Numerical Integration

Z b. f(x)dx. Yet in the above two cases we know what f(x) is. Sometimes, engineers want to calculate an area by computing I, but...

1 Linear Least Squares

MATH 144: Business Calculus Final Review

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

Best Approximation in the 2-norm

Lecture 14 Numerical integration: advanced topics

III. Lecture on Numerical Integration. File faclib/dattab/lecture-notes/numerical-inter03.tex /by EC, 3/14/2008 at 15:11, version 9

Lecture 12: Numerical Quadrature

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Numerical Analysis. Doron Levy. Department of Mathematics Stanford University

Lecture Note 4: Numerical differentiation and integration. Xiaoqun Zhang Shanghai Jiao Tong University

Math 360: A primitive integral and elementary functions

Math 8 Winter 2015 Applications of Integration

Review of Gaussian Quadrature method

How can we approximate the area of a region in the plane? What is an interpretation of the area under the graph of a velocity function?

Math 270A: Numerical Linear Algebra

MATH34032: Green s Functions, Integral Equations and the Calculus of Variations 1

Math 61CM - Solutions to homework 9

ODE: Existence and Uniqueness of a Solution

p(x) = 3x 3 + x n 3 k=0 so the right hand side of the equality we have to show is obtained for r = b 0, s = b 1 and 2n 3 b k x k, q 2n 3 (x) =

Numerical Analysis. 10th ed. R L Burden, J D Faires, and A M Burden

APPROXIMATE INTEGRATION

221B Lecture Notes WKB Method

Chapter 5. Numerical Integration

1 The Riemann Integral

Analytical Methods Exam: Preparatory Exercises

Lecture Notes: Orthogonal Polynomials, Gaussian Quadrature, and Integral Equations

Convex Sets and Functions

CS667 Lecture 6: Monte Carlo Integration 02/10/05

Numerical Integration

Definite integral. Mathematics FRDIS MENDELU

Math 1B, lecture 4: Error bounds for numerical methods

Euler, Ioachimescu and the trapezium rule. G.J.O. Jameson (Math. Gazette 96 (2012), )

LECTURE. INTEGRATION AND ANTIDERIVATIVE.

Definite integral. Mathematics FRDIS MENDELU. Simona Fišnarová (Mendel University) Definite integral MENDELU 1 / 30

Review of basic calculus

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

Riemann Sums and Riemann Integrals

Lecture 20: Numerical Integration III

Lecture 1. Functional series. Pointwise and uniform convergence.

Partial Derivatives. Limits. For a single variable function f (x), the limit lim

Riemann Sums and Riemann Integrals

Calculus I-II Review Sheet

Section 4.8. D v(t j 1 ) t. (4.8.1) j=1

Overview of Calculus I

Numerical Methods I Orthogonal Polynomials

221A Lecture Notes WKB Method

Sturm-Liouville Eigenvalue problem: Let p(x) > 0, q(x) 0, r(x) 0 in I = (a, b). Here we assume b > a. Let X C 2 1

MORE FUNCTION GRAPHING; OPTIMIZATION. (Last edited October 28, 2013 at 11:09pm.)

Lecture notes. Fundamental inequalities: techniques and applications

4.4 Areas, Integrals and Antiderivatives

Chapter 3 Solving Nonlinear Equations

Note 16. Stokes theorem Differential Geometry, 2005

An instructive toy model: two paradoxes

440-2 Geometry/Topology: Differentiable Manifolds Northwestern University Solutions of Practice Problems for Final Exam

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

Math 520 Final Exam Topic Outline Sections 1 3 (Xiao/Dumas/Liaw) Spring 2008

COSC 3361 Numerical Analysis I Numerical Integration and Differentiation (III) - Gauss Quadrature and Adaptive Quadrature

Transcription:

Numericl Methods in Economics Alexis Akir Tod November 5, 07 Polynomil interpoltion Polynomils re gret becuse we cn differentite nd integrte them very esily. Since degree n polynomil is determined by n coefficients, once we specify n points on the xy plne, there exists (t most) one polynomil tht psses through these points.. Lgrnge interpoltion The Lgrnge interpoltion gives n explicit formul. Proposition. Let x < < x n nd define the k-th Lgrnge polynomil l k L k (x) = (x x l) l k (x k x l ) for k =,..., n. Then p(x) = n y k L k (x) is the unique polynomil of degree up to n stisfying p(x k ) = y k for k =,..., n. Proof. By the definition of L k (x), we hve L k (x l ) = δ kl (Kronecker s delt ). Therefore for ll l, we hve p(x l ) = n y k L k (x l ) = n y k δ kl = y l. Clerly L k (x) is polynomil of degree n, so p(x) is polynomil of degree up to n. If we interpolte function f(x) t the points x < < x n by degree n polynomil, wht is the error? The following proposition gives n error bound if f is sufficiently smooth. tod@ucsd.edu https://en.wikipedi.org/wiki/kronecker_delt

Proposition. Let f be C n nd p n be the interpolting polynomil of f t x,..., x n. Then for ny x, there exists ξ in the convex hull of {x, x,..., x n } such tht f(x) p n (x) = f (n) (ξ) n (x x k ). n! Proof. Let I = co {x, x,..., x n }. For ny t I, let R(t) = f(t) p n (t) be the error term nd define g(t) = R(t)S(x) R(x)S(t), where S(t) = n (t x k). Clerly g(x) = 0. Furthermore, since R(x k ) = S(x k ) = 0, we hve g(x k ) = 0 for k =,..., n. In generl, if g is differentible nd g() = g(b) = 0, then there exists c (, b) such tht g (c) = 0 (Rolle s theorem ). Therefore there exist n points y,..., y n between x, x,..., x n such tht g (y k ) = 0 for k =,..., n. Continuing this rgument, there exists ξ I such tht g (n) (ξ) = 0. But since S is degree n polynomil with leding coefficient, we hve S (n) = n!, so 0 = g (n) (ξ) = R (n) (ξ)s(x) R(x)n!. Since R(t) = f(t) p n (t) nd deg p n n, we obtin R (n) (ξ) = f (n) (ξ). Therefore f(x) p n (x) = R(x) = n! f (n) (ξ)s(x) = f (n) (ξ) n!. Chebyshev polynomils n (x x k ). If we wnt to interpolte function on n intervl by polynomil, how should we choose the interpoltion nodes x,..., x n? First, without loss of generlity we my ssume tht the intervl is [, ]. Since f (n) (ξ) depends on the prticulr function f but n (x x k) does not, it mkes sense to find x,..., x n so s to minimize n mx (x x x [,] k ). Chebyshev 3 hs solved this problem long time go. The degree n Chebyshev polynomil T n (x) is obtined by expnding cos nθ s degree n polynomil of cos θ nd setting x = cos θ. For instnce, cos 0θ = = T 0 (x) =, cos θ = cos θ = T (x) = x, cos θ = cos θ = T (x) = x, nd so on. In generl, dding cos(n + )θ = cos nθ cos θ sin nθ sin θ, cos(n )θ = cos nθ cos θ + sin nθ sin θ, https://en.wikipedi.org/wiki/rolle s_theorem 3 https://en.wikipedi.org/wiki/pfnuty_chebyshev

nd setting x = cos nθ, we obtin Theorem 3. The solution of T n+ (x) = xt n (x) T n (x). min mx x,...,x n x [,] n (x x k ) is given by x k = cos k n π, in which cse n (x x k) = n T n (x). Proof. Let p(x) = n T n (x). By the bove recursive formul, the leding coefficient of T n (x) is n. Therefore the leding coefficient of p(x) is. Since p(cos θ) = n cos nθ, clerly sup x [,] p(x) = n. Suppose tht there exists degree n polynomil q(x) with leding coefficient such tht sup x [,] q(x) < n. Agin since p(cos θ) = n cos nθ, we hve p(x) = ( ) k n t x = y k = cos kπ/n, where k = 0,,..., n. Since q(x) < n for ll x [, ], by the intermedite vlue theorem there exits z,..., z n between y 0,..., y n such tht p(z k ) q(z k ) = 0. But since p, q re polynomils of degree n with leding coefficient, r(x) := p(x) q(x) is polynomil of degree up to n. Since r(z k ) = 0 for k =,..., n, it must be r(x) 0 or p q, which is contrdiction. Therefore n (x x k) = n T n (x), so x k = cos k n π for k =,..., n. Qudrture Mny economic problems involve mximizing the expected vlue. For exmple, typicl optiml portfolio problem looks like mx E[u(R(θ)w)], θ where w is initil welth, u is Bernoulli utility function, nd R(θ) denotes the portfolio return. Since expecttions re integrls, nd mny integrls cnnot be computed explicitly, we need methods to numericlly evlute the integrls, which re clled qudrture (or numericl integrtion). A typicl qudrture looks like f(x) dx w n f(x n ), where f is generl integrnd nd {x n } N re nodes nd {w n} N re weights of the qudrture rule. See Dvis nd Rbinowitz (984) for stndrd textbook tretment.. Newton-Cotes qudrture The simplest qudrture rule is to divide the intervl [, b] into N evenspced subintervls (so x n = + n N (b ) for n =,..., N) nd choose the weights {w n } N so tht one cn integrte ll polynomils of degree N or 3

less exctly. This qudrture rule is known s the N-point Newton-Cotes rule. Since we cn mp the intervl [0, ] to [, b] through the liner trnsformtion x + (b )x, without loss of generlity let us ssume = 0 nd b =. Let us consider severl cses... N = (trpezoidl rule) The -point Newton-Cotes rule is known s the trpezoidl rule. In this cse we hve x n = 0,, nd we choose w, w to integrte liner function exctly. Therefore = = 0 0 dx = w + w, x dx = w, so solving these equtions we obtin w = w =. Therefore f(x) dx b (f() + f(b)). Let us estimte the error of this pproximtion. Let p(x) be the degree interpolting polynomil of f t x =, b. Since p grees with f t, b, clerly Therefore by Proposition, we obtin p(x) dx = b (f() + f(b)). f(x) dx b (f() + f(b)) = = (f(x) p(x)) dx f (ξ(x)) (x )(x b) dx, where ξ(x) (, b). Since (x )(x b) < 0 on (, b), by the men vlue theorem for Riemn-Stieltjes integrls, there exists c (, b) such tht f (ξ(x)) (x )(x b) dx = f (c) (x )(x b) dx = f (c) (b )3. Therefore we cn estimte the error s f(x) dx b (f() + f(b)) f (b )3... N = 3 (Simpson s rule) The 3-point Newton-Cotes rule is known s Simpson s rule. In this cse we hve x n = 0, /,, nd we choose w, w, w 3 to integrte qudrtic function 4

exctly. Therefore = = 3 = 0 0 0 dx = w + w + w 3, x dx = w + w 3, x dx = 4 w + w 3, so solving these equtions we obtin w = w 3 = 6 nd w = 3. Therefore Interestingly, since f(x) dx b 6 4 = 0 ( f() + 4f ( + b x 3 dx = 8 w + w 3, ) ) + f(b). Simpson s rule ctully integrtes polynomils of degree 3 exctly (even though it is not designed to do so). To estimte the error of Simpson s rule, tke ny point d (, b) nd let p(x) be degree 3 interpolting polynomil of f t x =, +b, b, d. Since Simpson s rule integrtes degree 3 polynomils exctly, by Proposition we hve f(x) dx b 6 = (f(x) p(x)) dx = ( f() + 4f ( + b ) ) + f(b) f (4) ( (ξ(x)) (x ) x + b ) (x b)(x d) dx. 4! Since d (, b) is rbitrry, we cn tke d = +b. Since ( (x ) x + b ) (x b) < 0 on (, b) lmost everywhere, s before we cn pply the men vlue theorem. Using the chnge of vrible x = +b t, we cn compute + b ( (x ) x + b ) (x b) dx ( ) 5 = (t + )t (t ) dt = 0 (b )5. Since 4! = 4 nd 4 0 = 880, the integrtion error is f(x) dx b ( ( ) + b f() + 4f + f(b)) 6 f (4) 880 (b )5. 5

. Compound rule Newton-Cotes rule with N 4 re lmost never used becuse beyond some order some of the weights {w n } N become negtive, which introduces rounding errors. One wy to void this problem is to divide the intervl [, b] into N evenspced subintervls nd pply the trpezoidl rule or the Simpson s rule to ech subintervl. This method is known s the compound (or composite) rule. If you use the trpezoidl rule, then there re N+ points. Letting x n = n/n for n = 0,,..., N, the formul for [0, ] is 0 f(x) dx N (f(x n ) + f(x n )) = N (f(x 0) + f(x ) + + f(x N ) + f(x N )). (Just remember tht the reltive weights re t endpoints nd in between.) Since b = /N nd there re N subintervls, the error of the (N + )-point trpezoidl rule is f N. If you use Simpson s rule, then there re 3 points on ech subintervl, of which there re N, nd N endpoints re counted twice. Therefore the totl number of points is 3N (N ) = N +. Letting x n = n/(n) for n = 0,,..., N, the formul for [0, ] is 0 f(x) dx 6N (f(x n ) + 4f(x n ) + f(x n )) = 6N (f(x 0) + 4f(x ) + f(x ) + + 4f(x N ) + f(x N )). (Just remember tht the reltive weights re t endpoints, nd they lternte like 4,, 4,,..., 4,, 4 in between.) Since b = /N nd there re N subintervls, the error of the (N + )-point Simpson s rule is f (4) 880 N 4. Since the qudrture weights re given explicitly for trpezoidl nd Simpson s rule, it is strightforwrd to write progrms tht compute numericl integrls. The tbles below show the log 0 reltive errors of integrls over the intervl [0, ] (log 0 Î/I, where I is the true integrl nd Î is the numericl one) for severl functions when we use the N-point compound trpezoidl nd Simpson s rule. As the bove error nlysis suggests, errors tend to be smller when the integrnd is smoother (hs higher order derivtives). Furthermore, Simpson s rule is more ccurte thn the trpezoidl rule. Tble. log 0 reltive errors of compound trpezoidl rule. # points x / x 3/ x 5/ x 7/ x 9/ e x 3 -.038 -.743-0.7343-0.4896-0.304 -.6830 5 -.4550 -.7558 -.3394 -.0875-0.8937 -.838 9 -.896 -.3438 -.947 -.6885 -.498 -.8855 7 -.3346 -.936 -.545 -.90 -.094-3.4874 33 -.7795-3.534-3.474 -.89 -.6960-4.0895 65-3.64-4.87-3.7495-3.4943-3.980-4.695 6

Tble. log 0 reltive errors of compound Simpson s rule. # points x / x 3/ x 5/ x 7/ x 9/ e x 3 -.3676 -.75 -.3780 -.89 -.040-3.47 5 -.879 -.9667-3.3705 -.983 -.399-4.6667 9 -.69-3.74-4.384-4.584-3.589-5.8684 7 -.706-4.4649-5.4-5.3435-4.7350-7.070 33-3.7-5.68-6.4470-6.5346-5.9399-8.759 65-3.637-5.969-7.4884-7.797-7.443-9.4800.3 Gussin qudrture In the Newton-Cotes qudrture, we ssume tht the nodes re even-spced, but of course this is not necessry. Cn we do better by choosing the qudrture nodes optimlly? In generl, consider the integrl w(x)f(x) dx, where < b re endpoints of integrtion, w(x) > 0 is some (fixed) weighting function, nd f is generl integrnd. A typicl exmple is =, b =, nd w(x) = /σ πσ, in which cse we wnt to compute the e (x µ) expecttion E[f(X)] when X N(µ, σ ). In the discussion below, let us omit, b (so mens ) nd ssume tht w(x)x n dx exists for ll n 0. For functions f, g, let us define the inner product (f, g) by (f, g) = w(x)f(x)g(x) dx. Let p n(x) be the orthogonl polynomil of degree n corresponding to the weighting function w(x). This mens tht (p m, p n) = δ mn, where δ mn is Kronecker s delt. Orthogonl polynomils (with positive leding coefficients) uniquely exist nd cn be constructed using the Grm-Schmidt orthonormliztion. 4 In fct, we cn recursively compute the orthogonl polynomils using the three-term recurrence reltion (TTRR) s follows. Proposition 4 (TTRR). Let p (x) = 0, p 0 (x) =, nd for n 0 define p n(x) = p n (x)/(p n, p n ) /, p n+ (x) = xp n(x) (xp n, p n)p n(x) (p n, p n ) / p n (x). Then p n(x) is the n-degree orthogonl polynomil. Proof. Clerly (p n, p n) = for ll n. Therefore it suffices to show tht (p m, p n) = 0 whenever m < n. Let us prove this by induction on n 0. If n = 0, there is nothing to prove. If n =, since p (x) = xp 0(x) (xp 0, p 0)p 0(x), tking the inner product with p 0(x), we obtin (p, p 0) = (xp 0, p 0) (xp 0, p 0) = 0. 4 https://en.wikipedi.org/wiki/grm-schmidt_process 7

Therefore by rescling p to p, we obtin (p 0, p ) = 0. Suppose the clim holds up to n. Then for n +, since p n+ (x) = xp n(x) (xp n, p n)p n(x) (p n, p n ) / p n (x), tking the inner product with p n, we obtin (p n+, p n) = (xp n, p n) (xp n, p n) = 0. Similrly, tking the inner product with p n, we obtin (p n+, p n ) = (xp n, p n ) (p n, p n ) / = (p n, xp n ) (p n, p n ) /. Let k n > 0 be the leding coefficient of p n. By the recursive definition nd the normliztion, we hve k n = k n /(p n, p n ) /. Since xp n is n n-degree polynomil with leding coefficient k n, it cn be expnded s Therefore xp n (x) = k n p k n(x) + low order polynomils. n (p n+, p n ) = k n k n (p n, p n ) / = 0. The following lemm shows tht n n-degree orthogonl polynomil hs exctly n rel roots (so they re ll simple). Lemm 5. p n(x) hs exctly n rel roots on (, b). Proof. By the fundmentl theorem of lgebr, p n(x) hs exctly n roots in C. Suppose on the contrry tht p n(x) hs less thn n rel roots on (, b). Let x,..., x k (k < n) those roots t which p n (x) chnges its sign. Let p(x) = (x x ) (x x k ). Since p n(x)p(x) > 0 (or < 0) lmost everywhere on (, b), we hve (p n, p) = w(x)p n(x)p(x) dx 0. On the other hnd, since deg p = k < n nd orthogonl polynomils re linerly independent, we cn express p s weighted sum of p m s, where m k. By the definition of the orthogonl polynomils, it follows tht (p n, p) = 0, which is contrdiction. The following theorem shows tht using the n roots of the degree n orthogonl polynomil s qudrture nodes nd choosing specific weights, we cn integrte ll polynomils of degree up to n exctly. This is known s Gussin qudrture. Theorem 6 (Gussin qudrture). Let < x < < x n < b be the n roots of p n nd define w k = w(x)l k (x) dx 8

for k =,..., n, where L k (x) is s in Proposition. Then n w(x)p(x) dx = w k p(x k ) for ll polynomils p(x) of degree up to n. Proof. Since deg p n nd deg p n = n, we cn write p(x) = p n(x)q(x) + r(x), where deg q, deg r n. Since q cn be expressed s liner combintion of orthogonl polynomils of degree up to n, we hve (p n, q) = 0. Hence w(x)p(x) dx = (p n, q) + w(x)r(x) dx = w(x)r(x) dx. On the other hnd, since {x k } n re roots of p n, we hve for ll k, so in prticulr p(x k ) = p n(x k )q(x k ) + r(x k ) = r(x k ) n w k p(x k ) = n w k r(x k ). Therefore it suffices to show the clim for polynomils r of degree up to n. Since by Proposition ny such polynomil cn be represented s liner combintion of L k s, it suffices to show the clim for ll L k s. But since by definition n w(x)l k (x) dx = w k = w l L k (x l ), the clim is true. In prctice, how cn we compute the nodes {x n } N nd weights {w n} N of the N-point Gussin qudrture? The solution is given by the following Golub-Welsch lgorithm. Theorem 7 (Golub-Welsch). Let k n > 0 be the leding coefficient of p n, α n = k n /k n > 0, nd β n = (xp n, p n). Define the N N symmetric mtrix J N by β 0 α 0 0. α β α... J N =. 0 α β.. 0........... αn 0 0 α N β N Then the Gussin qudrture nodes {x n } N re eigenvlues of J N, nd the weights {w n } N re given by l= N = p w k(x n ) > 0. n k=0 9

Proof. By the proof of Proposition 4, we hve (p n, p n ) / = k n /k n = α n. Therefore TTRR becomes p n+ (x) = xp n(x) β n p n(x) α n p n (x). Since p n+(x) = p n+ (x)/(p n+, p n+ ) / = p n+ (x)/α n+, TTRR becomes α n p n (x) + β n p n(x) + α n+ p n+(x) = xp n(x). In prticulr, setting x = x k (where x k is root of p N ), we obtin α n p n (x k ) + β n p n(x k ) + α n+ p n+(x k ) = xp n(x k ) for ll n nd k =,..., N. Since p = 0 by definition nd p N (x k) = 0, letting P (x) = (p 0(x),..., p N (x)) nd collecting the bove eqution into vector we obtin J N P (x k ) = x k P (x k ) for k =,..., N. Define the N N mtrix P by P = (P (x ),..., P (x N )). Since δ mn = (p m, p n) = w(x)p m(x)p n(x) dx = w k p m(x k )p n(x k ) for m, n N becuse the Gussin qudrture integrtes ll polynomils of degree up to n exctly, letting W = dig(w,..., w N ) we hve P W P = I. Therefore P, W re invertible. Solving for W nd tking the inverse, we obtin W = P P N = p w k(x n ) > 0 n for ll n. Since J N P (x n ) = x n P (x n ) for n =,..., N, collecting into mtrix we obtin J N P = XP P J N P = X, where X = dig(x,..., x N ). Therefore {x n } N re eigenvlues of J N. Below re some exmples. By googling you cn find subroutines in Mtlb or whtever lnguge tht compute the nodes nd weights of these qudrtures. Exmple. The cse (, b) = (, ), w(x) = is known s the Guss- Legendre qudrture. Exmple. The cse (, b) = (, ), w(x) = / x is known s the Guss-Chebyshev qudrture. It is useful for computing Fourier coefficients (through the chnge of vrible x = cos θ). Exmple 3. The cse (, b) = (, ), w(x) = e x is known s the Guss- Hermite qudrture, which is useful for computing the expecttion with respect to the norml distribution. Exmple 4. The cse (, b) = (0, ), w(x) = e x is known s the Guss- Lguerre qudrture, which is useful for computing the expecttion with respect to the exponentil distribution. The tble below shows the log 0 reltive errors when using the N-point Guss-Legendre qudrture. You cn see tht Gussin qudrture is overwhelmingly more ccurte thn Newton-Cotes. k=0 0

Tble 3. log 0 reltive errors of compound trpezoidl rule. # points x / x 3/ x 5/ x 7/ x 9/ e x 3 -.437-3.389-3.8570-4.055-3.884-6.39 5-3.045-4.3578-5.3560-6.0948-6.608 -.494 9-3.748-5.5649-7.0688-8.336-9.406-5.9546 7-4.5396-6.8986-8.9436-0.759 -.393-5.9546 33-5.386-8.308-0.99-3.309-5.355 3 Discretiztion If the gol is to solve single optimiztion problem tht involves expecttions (e.g., sttic optiml portfolio problem), highly ccurte Gussin qudrture is nturl choice. However, mny economic problems re dynmic, in which cse one needs to compute conditionl expecttions. Furthermore, to reduce the computtionl complexity of the problem, it is desirble tht the qudrture nodes re pressigned insted of being dependent on the prticulr stte of the model. Discretiztion is useful tool for solving such problems. 3. Erlier methods For concreteness, consider the Gussin AR() process x t = ρx t + ε t, ɛ t N(0, σ ). Then the conditionl distribution of x t given x t is N(ρx t, σ ). How cn we discretize (find finite-stte Mrkov chin pproximtion) of this stochstic process? A clssic method is Tuchen (986) but you should never use it becuse it is not ccurte (so I won t explin further). Similrly, the quntile method in Add nd Cooper (003) is poor. For Gussin AR() process, the Rouwenhorst (995) is good becuse the conditionl moments re exct up to order nd the method is constructive (does not involve optimiztion). It is especilly useful when ρ 0.99. The Tuchen nd Hussey (99) method, which I explin now, uses the Gussin qudrture. First consider discretizing N(0, σ ). Letting {x n } N nd {w n } N be the nodes nd weights of the N-point Guss-Hermite qudrture, since for ny integrnd g we hve E[g(X)] = = g(x) πσ e x σ dx g( σy) π e y dy w n π g( σx n ), we cn use the nodes x n = σx n nd weights w n = w n / π to discretize N(0, σ ). The sme ide cn be used to discretize the Gussin AR() process. Let us fix the nodes {x n} N s constructed bove. Since for ny integrnd g, letting

µ = ρx m we hve E [g(x t ) x t = x m] = = g(x) πσ (x µ) e σ dx g(x)e µ xµ σ x e σ dx πσ w ne µ x n µ σ g(x n), so we cn construct the trnsition probbility mtrix P = (p mn ) by p mn w ne µ x n µ σ, where µ = ρx m nd the constnt of proportionlity is determined by N p mn =. The Tuchen-Hussey method is pretty good if ρ 0.5, lthough drwbck is tht it ssumes Gussin shocks. Furthermore, the performnce deteriortes when ρ becomes lrger. 3. Frmer-Tnk-Tod mximum entropy method Severl ppers by me nd my couthors (Tnk nd Tod, 03, 05; Frmer nd Tod, 07) provide more ccurte nd generlly pplicble discretiztion method (so it should be the first choice!). Below I briefly explin the method, but see Frmer nd Tod (07) for more detils. 3.. Discretizing probbility distributions Suppose tht we re given continuous probbility density function f : R K R, which we wnt to discretize. Let X be rndom vector with density f, nd g : R K R be ny bounded continuous function. The first step is to pick qudrture formul E[g(X)] = g(x)f(x) dx R K w n g(x n )f(x n ), () where N is the number of integrtion points, {x n } N, nd w n > 0 is the weight on the integrtion point x n. For now, we do not tke stnce on the choice of the initil qudrture formul, but tke it s given. Given the qudrture formul (), corse but vlid discrete pproximtion of the density f would be to ssign probbility q n to the point x n proportionl to w n f(x n ), so q n = w n f(x n ) N w nf(x n ). () However, this is not necessrily good pproximtion becuse the moments of the discrete distribution {q n } do not generlly mtch those of f. Tnk nd Tod (03) propose exctly mtching finite set of moments by updting the probbilities {q n } in prticulr wy. Let T : R K R L

be function tht defines the moments tht we wish to mtch nd let T = T (x)f(x) dx be the vector of exct moments. For exmple, if we wnt to R K mtch the first nd second moments in the one dimensionl cse (K = ), then T (x) = (x, x ). Tnk nd Tod (03) updte the probbilities {q n } by solving the optimiztion problem minimize {p n} subject to mx λ R L p n log p n q n p n T (x n ) = T, p n =, p n 0. The objective function in the priml problem (P) is the Kullbck nd Leibler (95) informtion of {p n } reltive to {q n }, which is lso known s the reltive entropy. This method mtches the given moments exctly while keeping the probbilities {p n } s close to the initil pproximtion {q n } s possible in the sense of the Kullbck-Leibler informtion. Note tht since (P) is convex minimiztion problem, the solution (if one exists) is unique. The optimiztion problem (P) is constrined minimiztion problem with lrge number (N) of unknowns ({p n }) with L + equlity constrints nd N inequlity constrints, which is in generl computtionlly intensive to solve. However, it is well-known tht entropy-like minimiztion problems re computtionlly trctble by using dulity theory (Borwein nd Lewis, 99). Tnk nd Tod (03) convert the priml problem (P) to the dul problem [ ( N )] λ T log q n e λ T (x n), (D) which is low dimensionl (L unknowns) unconstrined concve mximiztion problem nd hence computtionlly trctble. The following theorem shows how the solutions to the two problems (P) nd (D) re relted. Below, the symbols int nd co denote the interior nd the convex hull of sets. Theorem 8.. The priml problem (P) hs solution if nd only if T co T (D N ). If solution exists, it is unique.. The dul problem (D) hs solution if nd only if T int co T (D N ). If solution exists, it is unique. 3. If the dul problem (D) hs (unique) solution λ N, then the (unique) solution to the priml problem (P) is given by p n = (P) q n e λ N T (xn) N q ne = q n e λ N (T (xn) T ) λ N T (xn) N q ne λ N (T (xn) T. (3) ) Theorem 8 provides prcticl wy to implement the Tnk-Tod method. After choosing the initil discretiztion Q = {q n } nd the moment defining function T, one cn numericlly solve the unconstrined optimiztion problem (D). To this end, we cn insted solve min λ R L q n e λ (T (x n) T ) (D ) 3

becuse the objective function in (D ) is monotonic trnsformtion ( times the exponentil) of tht in (D). Since (D ) is n unconstrined convex minimiztion problem with (reltively) smll number (L) of unknowns (λ), solving it is computtionlly simple. Letting J N (λ) be the objective function in (D ), its grdient nd Hessin cn be nlyticlly computed s J N (λ) = J N (λ) = q n e λ (T (x n) T ) (T (x n ) T ), q n e λ (T (x n) T ) (T (x n ) T )(T (x n ) T ), (4) (4b) respectively. In prctice, we cn quickly solve (D ) numericlly using optimiztion routines by supplying the nlyticl grdient nd Hessin. 5 If solution to (D ) exists, it is unique, nd we cn compute the updted discretiztion P = {p n } by (3). If solution does not exist, it mens tht the regulrity condition T int co T (D N ) does not hold nd we cnnot mtch moments. Then one needs to select smller set of moments. Numericlly checking whether moments re mtched is strightforwrd: by (3), (D ), nd (4), the error is p n T (x n ) T = N q ne λ N (T (xn) T ) (T (x n ) T ) N q ne λ N (T (xn) T ) 3.. Discretizing generl Mrkov processes = J N (λ N ) J N (λ N ). (5) Next we show how to extend the Tnk-Tod method to the cse of timehomogeneous Mrkov processes. Consider the time-homogeneous first-order Mrkov process P (x t x x t = x) = F (x, x), where x t is the vector of stte vribles nd F (, x) is cumultive distribution function (CDF) tht determines the distribution of x t = x given x t = x. The dynmics of ny Mrkov process re completely chrcterized by its Mrkov trnsition kernel. In the cse of discrete stte spce, this trnsition kernel is simply mtrix of trnsition probbilities, where ech row corresponds to conditionl distribution. We cn discretize the continuous process x by pplying the Tnk-Tod method to ech conditionl distribution seprtely. More concretely, suppose tht we hve set of grid points D N = {x n } N nd n initil corse pproximtion Q = (q nn ), which is n N N probbility trnsition mtrix. Suppose we wnt to mtch some conditionl moments of x, represented by the moment defining function T (x). The exct conditionl moments when the current stte is x t = x n re T n = E [T (x t ) x n ] = T (x) df (x, x n ), 5 Since the dul problem (D) is concve mximiztion problem, one my lso solve it directly. However, ccording to our experience, solving (D ) is numericlly more stble. This is becuse the objective function in (D) is close to liner when λ is lrge, so the Hessin is close to singulr nd not well-behved. On the other hnd, since the objective function in (D ) is the sum of exponentil functions, it is well-behved. 4

where the integrl is over x, fixing x n. (If these moments do not hve explicit expressions, we cn use highly ccurte qudrture formuls to compute them.) By Theorem 8, we cn mtch these moments exctly by solving the optimiztion problem minimize {p nn } N n = subject to n = p nn log p nn q nn p nn T (x n ) = T n, n = p nn =, p nn 0 (P n ) n = for ech n =,,..., N, or equivlently the dul problem min λ R L n = q nn e λ (T (x n ) T n). (D n) (D n) hs unique solution if nd only if the regulrity condition T n int co T (D N ) (6) holds. We summrize our procedure in Algorithm below. Algorithm (Discretiztion of Mrkov processes).. Select discrete set of points D N = {x n } N nd n initil pproximtion Q = (q nn ).. Select moment defining function T (x) nd corresponding exct conditionl moments { } N Tn. If necessry, pproximte the exct conditionl moments with highly ccurte numericl integrl. 3. For ech n =,..., N, solve minimiztion problem (D n) for λ n. Check whether moments re mtched using formul (5), nd if not, select smller set of moments. Compute the conditionl probbilities corresponding to row n of P = (p nn ) using (3). The resulting discretiztion of the process is given by the trnsition probbility mtrix P = (p nn ). Since the dul problem (D n) is n unconstrined convex minimiztion problem with typiclly smll number of vribles, stndrd Newton type lgorithms cn be pplied. Furthermore, since the probbilities (3) re strictly positive by construction, the trnsition probbility mtrix P = (p nn ) is strictly positive mtrix, so the resulting Mrkov chin is sttionry nd ergodic. 4 Projection In economics we often need to solve functionl equtions. For instnce, in n income fluctution problem, we need to chrcterize the optiml consumption rule c(w, y) given welth w nd income y. The projection method ( stndrd reference is Judd, 99) pproximtes the policy function (wht you wnt to 5

solve for, like c(w, y)) on some compct set by polynomil. See Pohl et l. (07) for nice ppliction of the projection method. By Theorem 3 if you wnt to pproximte smooth function f on [, ] by degree N polynomil, it is optiml to interpolte f t the roots of the degree N Chebyshev polynomil. The ide of the projection method is to pproximte the policy function f by liner combintion of Chebyshev polynomils, f(x) f(x) = N n=0 n T n (x), nd determine the coefficients { n } N n=0 to mke the functionl eqution (tht you wnt to solve) true t the Chebyshev nodes. It is esier to see how things work by looking t n exmple. Suppose you wnt to solve the differentil eqution y (t) = y(t), with initil condition y(0) =. Of course the solution is y(t) = e t, but let s pretend tht we don t know the solution nd solve it numericlly. Suppose we wnt to compute numericl solution for t [0, T ]. We cn do s follows.. Mp [0, T ] to [, ] by the ffine trnsformtion t t T T.. Approximte y(t) by ŷ(t) = N n=0 nt n ( t T T ) 3. Determine { n } N n=0 by setting ŷ (t) = ŷ(t) t t corresponding to Chebyshev nodes for degree N (find t n by solving tn T T = cos ( n N π) for n =,..., N). 4. In this cse, must lso impose initil condition ŷ(0) =, so for exmple cn minimize sum of squred residuls t Chebyshev nodes: minimize { n} N n=0 N (ŷ (t n ) ŷ(t n )) n=0 subject to ŷ(0) =. The figure below shows the log 0 reltive errors when T = 4 nd N = 3, 4,.... You cn see tht the reltive errors become smller s we increse the degree of polynomil pproximtion. References Jérôme Add nd Russel W. Cooper. Dynmic Economics: Quntittive Methods nd Applictions. MIT Press, Cmbridge, MA, 003. Jonthn M. Borwein nd Adrin S. Lewis. Dulity reltionships for entropylike minimiztion problems. SIAM Journl on Control nd Optimiztion, 9 ():35 338, Mrch 99. doi:0.37/03907. Philip J. Dvis nd Philip Rbinowitz. Methods of Numericl Integrtion. Acdemic Press, Orlndo, FL, second edition, 984. 6

0 - log 0 reltive errors -4-6 3rd order 4th order -8 5th order 6th order 7th order -0 8th order 0 0.5.5.5 3 3.5 4 t Lelnd E. Frmer nd Alexis Akir Tod. Discretizing nonliner, non-gussin Mrkov processes with exct conditionl moments. Quntittive Economics, 8():65 683, July 07. doi:0.398/qe737. Kenneth L. Judd. Projection methods for solving ggregte growth models. Journl of Economic Theory, 58():40 45, December 99. doi:0.06/00-053(9)9006-l. Solomon Kullbck nd Richrd A. Leibler. On informtion nd sufficiency. Annls of Mthemticl Sttistics, ():79 86, Mrch 95. doi:0.4/oms/7779694. Wlter Pohl, Krl Schmedders, nd Ole Wilms. Higher-order effects in ssetpricing models with long-run risk. Journl of Finnce, 07. URL https: //ssrn.com/bstrct=540586. Forthcoming. K. Geert Rouwenhorst. Asset pricing implictions of equilibrium business cycle models. In Thoms F. Cooley, editor, Frontiers of Business Cycle Reserch, chpter 0, pges 94 330. Princeton University Press, 995. Ken ichiro Tnk nd Alexis Akir Tod. Discrete pproximtions of continuous distributions by mximum entropy. Economics Letters, 8(3):445 450, Mrch 03. doi:0.06/j.econlet.0..00. Ken ichiro Tnk nd Alexis Akir Tod. Discretizing distributions with exct moments: Error estimte nd convergence nlysis. SIAM Journl on Numericl Anlysis, 53(5):58 77, 05. doi:0.37/409769. George Tuchen. Finite stte Mrkov-chin pproximtions to univrite nd vector utoregressions. Economics Letters, 0():77 8, 986. doi:0.06/065-765(86)9068-0. George Tuchen nd Robert Hussey. Qudrture-bsed methods for obtining pproximte solutions to nonliner sset pricing models. Econometric, 59 ():37 396, Mrch 99. doi:0.307/9386. 7