Lecture VIII. Global Approximation Methods: I

Similar documents
Lecture X. Global Approximation Methods

CS 450 Numerical Analysis. Chapter 7: Interpolation

Natural Quartic Spline

Linear Interpolating Splines

Computational Physics PHYS 420

Mar. 20 Math 2335 sec 001 Spring 2014

lecture 10: B-Splines

February 2017 (1/20) 2 Piecewise Polynomial Interpolation 2.2 (Natural) Cubic Splines. MA378/531 Numerical Analysis II ( NA2 )

Lecture 6: Interpolation

Interpolation by Spline Functions

APPM/MATH Problem Set 4 Solutions

Polynomials tend to oscillate (wiggle) a lot, even when our true function does not.

Value Function Iteration versus Euler equation methods

Consider functions such that then satisfies these properties: So is represented by the cubic polynomials on on and on.

A Linear Programming Approach to Concave Approximation and Value Function Iteration

Maximizing an interpolating quadratic

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Rational Bezier Surface

Interpolation - 2D mapping Tutorial 1: triangulation

Lecture 9. Curve fitting. Interpolation. Lecture in Numerical Methods from 28. April 2015 UVT. Lecture 9. Numerical. Interpolation his o

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

Lecture 9: Introduction to Spline Curves

What is Multigrid? They have been extended to solve a wide variety of other problems, linear and nonlinear.

99 International Journal of Engineering, Science and Mathematics

Justify all your answers and write down all important steps. Unsupported answers will be disregarded.

8 Piecewise Polynomial Interpolation

Convergence of C 2 Deficient Quartic Spline Interpolation

Scientific Computing: Interpolation

Evaluating the polynomial at a point

PRIMAL-DUAL INTERIOR POINT METHOD FOR LINEAR PROGRAMMING. 1. Introduction

Math 226A Homework 4 Due Monday, December 11th

Curve and Surface Fitting with Splines. PAUL DIERCKX Professor, Computer Science Department, Katholieke Universiteit Leuven, Belgium

Today s class. Roots of equation Finish up incremental search Open methods. Numerical Methods, Fall 2011 Lecture 5. Prof. Jinbo Bi CSE, UConn

Four equations are necessary to evaluate these coefficients. Eqn

Advanced Operations Research Techniques IE316. Quiz 1 Review. Dr. Ted Ralphs

A new 8-node quadrilateral spline finite element

Deficient Quartic Spline Interpolation

Iterative Algorithms I: Elementary Iterative Methods and the Conjugate Gradient Algorithms

Introduction to Optimization Problems and Methods

Curve fitting using linear models

Generalised Mean Averaging Interpolation by Discrete Cubic Splines

Mathematical Programming and Research Methods (Part II)

Solving Systems of Spline Equations: A Linear Programming-based Approach

Asymptotic Error Analysis

CS321 Introduction To Numerical Methods

Remark. Jacobs University Visualization and Computer Graphics Lab : ESM4A - Numerical Methods 331

SPLINE APPROXIMATION VIA THE CONTROL POLYGON

Solve Non-Linear Parabolic Partial Differential Equation by Spline Collocation Method

An introduction to interpolation and splines

Moving Beyond Linearity

Handout 4 - Interpolation Examples

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

60 2 Convex sets. {x a T x b} {x ã T x b}

Reals 1. Floating-point numbers and their properties. Pitfalls of numeric computation. Horner's method. Bisection. Newton's method.

PS Geometric Modeling Homework Assignment Sheet I (Due 20-Oct-2017)

COMPUTATIONAL INTELLIGENCE (INTRODUCTION TO MACHINE LEARNING) SS18. Lecture 2: Linear Regression Gradient Descent Non-linear basis functions

Introduction to Programming for Engineers Spring Final Examination. May 10, Questions, 170 minutes

Contents. I The Basic Framework for Stationary Problems 1

1.2 Numerical Solutions of Flow Problems

CS-184: Computer Graphics

NOTATION AND TERMINOLOGY

Module 2: Single Step Methods Lecture 4: The Euler Method. The Lecture Contains: The Euler Method. Euler's Method (Analytical Interpretations)

and the crooked shall be made straight, and the rough ways shall be made smooth; Luke 3:5

Monotonic Cubic Spline Interpolation

Lecture 8. Divided Differences,Least-Squares Approximations. Ceng375 Numerical Computations at December 9, 2010

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Chapter 13. Boundary Value Problems for Partial Differential Equations* Linz 2002/ page

Sung-Eui Yoon ( 윤성의 )

COMPUTATIONAL INTELLIGENCE (CS) (INTRODUCTION TO MACHINE LEARNING) SS16. Lecture 2: Linear Regression Gradient Descent Non-linear basis functions

Diffusion Wavelets for Natural Image Analysis

An introduction to mesh generation Part IV : elliptic meshing

INTERPOLATION BY QUARTIC SPLINE

Concept of Curve Fitting Difference with Interpolation

EC422 Mathematical Economics 2

A general matrix representation for non-uniform B-spline subdivision with boundary control

x n x n stepnumber k order r error constant C r+1 1/2 5/12 3/8 251/720 abs. stab. interval (α,0) /11-3/10

Lecture 2 September 3

Chapter 18. Geometric Operations

MATH 2400, Analytic Geometry and Calculus 3

Lecture 2.2 Cubic Splines

Lecture 23: Starting to put it all together #2... More 2-Point Boundary value problems

Lecture 7: Support Vector Machine

(Sparse) Linear Solvers

Lacunary Interpolation Using Quartic B-Spline

Finite Element Analysis Prof. Dr. B. N. Rao Department of Civil Engineering Indian Institute of Technology, Madras. Lecture - 24

The Fundamentals of Economic Dynamics and Policy Analyses: Learning through Numerical Examples. Part II. Dynamic General Equilibrium

REGULAR GRAPHS OF GIVEN GIRTH. Contents

Topology optimization in B-spline space

Know it. Control points. B Spline surfaces. Implicit surfaces

Finite Element Methods

Fitting to a set of data. Lecture on fitting

TO DUY ANH SHIP CALCULATION

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

Important Properties of B-spline Basis Functions

Computational Economics and Finance

Parameterization of triangular meshes

Polynomial Approximation and Interpolation Chapter 4

Introduction to Mathematical Programming IE406. Lecture 20. Dr. Ted Ralphs

CS-184: Computer Graphics. Today

The use of the Spectral Properties of the Basis Splines in Problems of Signal Processing

Transcription:

Lecture VIII Global Approximation Methods: I Gianluca Violante New York University Quantitative Macroeconomics G. Violante, Global Methods p. 1 /29

Global function approximation Global methods: function interpolation over the entire domain First choice: type of approximation 1. Interpolation I: finite element methods Splines (e.g., B-splines, cubic splines, Schumaker splines) 2. Interpolation II: spectral methods Orthogonal polynomials (e.g., Chebyshev, Lagrange, etc...) Second choice: how to minimize residuals between true function and interpolant 1. Collocation 2. Least squares 3. Galerkin method G. Violante, Global Methods p. 2 /29

Interpolation Today, one dimension. We want to represent a real-valued function f on [a,b] with a computationally tractable function Interpolation is a form of function approximation in which the approximating (interpolant) and the true function must agree, i.e. they must have same value, at a finite number of points. In some cases additional restrictions are imposed on the interpolant. E.g., f evaluated at a finite number of points may have to agree with that of the underlying function. Other examples include additional constraints imposed on the interpolant such as monotonicity, convexity, or smoothness requirements. In general, interpolation is any method that takes information at a finite set of points, X, and finds a function which satisfies that information at X. G. Violante, Global Methods p. 3 /29

Interpolation We want to approximate a known function f (x). The interpolant ˆf is chosen to be a linear combination of a collection of basis functions {φ j (x)} n j=0 where n is the order/degree of interpolation Basis functions: linearly independent functions that span the family of functions chosen for the interpolation (the function space) any function in the space can be obtained as a linear combination of basis functions, just as every vector in a vector space can be obtained as a linear combination of basis vectors. In general we are interested in the space of continuous or continuously differentiable functions. G. Violante, Global Methods p. 4 /29

Interpolation Thus, for a given family of basis function {φ j } n j=0 we have: f(x) ˆf(x) n w j φ j (x) j=0 We have reduced the problem of characterizing an infinite-dimensional object, f, to the problem of determining the n weights (or coefficients) {w j } There is arbitrariness in interpolation: there are arbitrarily many functions passing through a finite number of points. Which basis? Choices: spectral or finite element methods depending whether the basis functions are nonzero over the entire domain of the true function (except possibly at a finite number of points) or nonzero only on a subinterval of the domain. G. Violante, Global Methods p. 5 /29

Finite element methods Use local basis These are called splines An order n spline consists of a series of n th order polynomial segments spliced together so as to preserve continuity of derivatives of order n 1 or less. The points at which the pieces are spliced together are called knots or breakpoints. By convention the first and last knots are the two extremes of the function domain. G. Violante, Global Methods p. 6 /29

Splines An order n spline with K +1 knots has K(n+1) parameters. The simplest way to proceed (Judd calls it the kindergarten procedure of connecting the dots ) is to use linear B-splines, where B stands for basic. Suppose we have a grid with knots x 0 <...x k <... < x K and we want to approximate a function f (x). B 0 splines are defined as right-continuous step functions B 0 k(x) = { 1 if x k x < x k+1 0 otherwise So interpolant is: ˆf (x) = K 1 k=0 [ ] f (xk )+f (x k+1 ) B 0 2 k(x) G. Violante, Global Methods p. 7 /29

Linear B-splines B 1 splines implement piece-wise linear interpolation B 1 k(x) = x x k 1 x k x k 1 if x k 1 x < x k x k+1 x x k+1 x k if x k x < x k+1 0 elsewhere and each one looks like a tent-function with peak at x k equal to one, thus the weight of the interpolant must be f (x k ) The interpolant is therefore defined as: ˆf (x) = K f (x k )Bk(x) 1 k=0 You can also obtain the same weights from 2K conditions: ˆf at knots equal to f(x) (K + 1 conditions), and interpolant continuous at interior knots (K 1 conditions) G. Violante, Global Methods p. 8 /29

Linear spline Basis Functions on [0, 1]. 1 0 1 0 1 0 0 1 0 1 0 1 G. Violante, Global Methods p. 9 /29

Linear B-splines It is easy to see that for any given point x on an interval [x k,x k+1 ] there are only two nonzero basis at x, B k (x) and B k+1 (x). To locate the knots (k,k +1) that bracket x you use a bracketing algorithm that essentially proceeds by bisection. Thus ˆf (x) = f (x k ) x k+1 x x k+1 x k +f (x k+1 ) x x k x k+1 x k = f (x k ) x k+1 x x k +x k x k+1 x k +f (x k+1 ) x x k x k+1 x k = f (x k )+[f (x k+1 ) f (x k )] x x k x k+1 x k that is a familiar formula for linear interpolation of decision rules (see later...) G. Violante, Global Methods p. 10 /29

Linear Spline approximation (7 knots) x 0 =a x 1 x 2 x 3 x 4 x 5 x 6 =b G. Violante, Global Methods p. 11 /29

Pros and cons of linear splines Pros: Preserves monotonicity and concavity of f. We can exploit information about f clustering points more closely together in areas of high curvature or areas where we know a kink exists in order to increase our accuracy. We can capture binding inequality constraints very well. Cons: The approximated function is not differentiable at the knots (they become kinks). ˆf = 0 where it exists (it does not exist at the knots). Function not smooth. G. Violante, Global Methods p. 12 /29

Cubic splines Cubic spline (n = 3), has 4K coefficients to be determined ˆf (xk ) = f (x k ) (K +1 conditions) Continuity of ˆf at interior points Continuity of ˆf at interior points Continuity of ˆf at interior points (K 1 conditions) (K 1 conditions) (K 1 conditions) ˆf (x 0 ) = ˆf (x K ) = 0 (2 conditions) These last two can be modified to something else depending on what is suitable in the particular case at hand, they are ad-hoc and they can be more than 2. G. Violante, Global Methods p. 13 /29

Cubic spline Basis Functions on [0,1]. 1 0 1 0 1 0 0 1 0 1 0 1 G. Violante, Global Methods p. 14 /29

Cubic spline Basis Functions on [0,1]. 60 50 Spline 1: Piecewise Linear Interpolation Spline 2: Piecewise Cubic Interpolation Data 40 30 20 10 0 0 5 10 15 20 25 G. Violante, Global Methods p. 15 /29

Pros and cons of cubic splines Pros: Easy to compute: interpolant matrix very sparse, easy to invert. Smooth approximation Cons: It may not be able to handle constraints well It does not preserve monotonicity and concavity of f G. Violante, Global Methods p. 16 /29

Schumaker splines So far: linear interpolation preserves shape (monotonicity and concavity), but not differentiability. Cubic splines preserves differentiability, but not shape. Schumaker quadratic splines preserve both (Schumaker, 1983, SIAM Journal on Numerical Analysis). By shape we mean that in those intervals where the data is monotonically increasing or decreasing, the spline has the same property. Similarly for convexity or concavity. Idea: add knots to a subinterval by means of an algorithm G. Violante, Global Methods p. 17 /29

Solving the income fluctuation problem V (a,y j ) = max {c,a } u(c)+β s.t. y i Y π(y i y j )V (a,y i ) c+a Ra+y j a a The Euler equation, once we substitute in the budget constraint, reads: u c (Ra+y j a ) βr π(y i y j )u c (Ra +y i a ) 0. y i Y where the strict inequality holds when the constraint binds. G. Violante, Global Methods p. 18 /29

Policy function iteration with linear interpolation 1. Construct a grid on the asset space {a 0,a 2,...,a m } with a 0 = a = 0. 2. Guess an initial vector of decision rules for a on the grid points, call it â 0 (a i,y j ), where the subscript 0 denotes the initial iteration 3. For each point (a i,y j ) on the grid, check whether the borrowing constraint binds. I.e. check whether: u c (Ra i +y j a 0 ) βr y Y π(y y j )u c (Ra 0 +y â 0 (a 0,y )) > 0. 4. If this inequality holds, the borrowing constraint binds. Then, set a 0(a i,y j ) = a 0 and repeat this check for the next grid point. If the equation instead holds with the < inequality, we have an interior solution (it is optimal to save for the household) and we proceed to the next step. G. Violante, Global Methods p. 19 /29

Policy function iteration with linear interpolation 5. For each point (a i,y j ) on the grid, use a nonlinear equation solver to find the solution a of the nonlinear equation u c (Ra i +y j a ) βr y Y π(y y j )u c (Ra +y â 0 (a,y )) = 0 (a) Need to evaluate the function â 0 (a,y ) outside grid points: assume it is piecewise linear. (b) Every time the solver calls an a which lies between grid points, do as follows. First, find the pair of adjacent grid points {a i,a i+1 } such that a i < a < a i+1, and then compute (â0 â 0 (a,y ) = â 0 (a i,y )+(a (a i+1,y ) â 0 (a i,y ) ) a i ) a i+1 a i (c) If the solution of the nonlinear equation is a, then set a 0(a i,y j ) = a and iterate on the next grid point. G. Violante, Global Methods p. 20 /29

Policy function iteration with linear interpolation 6. Check convergence by comparing a 0(a i,y j ) â 0 (a i,y j ) through some pre-specified norm. For example, declare convergence at iteration n when max i,j { a n(a i,y j ) â n (a i,y j ) } < ε for some small number ε which determines the degree of tolerance in the solution algorithm. 7. If convergence is achieved, stop. Otherwise, go back to point 3 with the new guess â 1 (a i,y j ) = a 0(a i,y j ). Note that the most time-consuming step in this procedure is 5, the root-finding problem. We now discuss how to avoid it. G. Violante, Global Methods p. 21 /29

Endogenous grid method (EGM) EGM is much faster than the traditional method because it does not require the use of a nonlinear equation solver The essential idea of the method is to construct a grid on a, next period s asset holdings, rather than on a, as is done in the standard algorithm. The method also requires the policy function to be at least weakly monotonic in the state Recall the Euler equation: u c (c(a,y)) βr y Y π(y y)u c (c(a,y )). As usual, we start from a guess ĉ 0 (a,y) and iterate on the Euler Equation until the decision rule for consumption that we solve for is essentially identical to the one in the previous iteration. G. Violante, Global Methods p. 22 /29

EGM: Algorithm 1. Construct a grid for (a,y) 2. Guess a policy function ĉ 0 (a i,y j ). If y is persistent, a good initial guess is to set ĉ 0 (a i,y j ) = ra i +y j which is the solution under quadratic utility if income follows a random walk. 3. Fix y j. Instead of iterating over {a i }, we iterate over {a i }. For any pair {a i,y j} on the mesh construct the RHS of the Euler equation [call it B(a i,y j)] B(a i,y j ) βr y Y π(y y j )u c (ĉ 0 (a i,y )) where the RHS of this equation uses the guess ĉ 0 on the grid G. Violante, Global Methods p. 23 /29

EGM: Algorithm 4. Use the Euler equation to solve for the value c(a i,y j) that satisfies u c ( c(a i,y j )) = B(a i,y j ) and note that it can be done analytically, e.g. for u c (c) = c γ we have c(a i,y j) = [B(a i,y j)] 1 γ. Here algorithm becomes much more efficient because it does not require a nonlinear solver. 5. From the budget constraint: c(a i,y j )+a i = Ra i +y j solve for a (a i,y j) the value of assets today that would lead the consumer to have a i assets tomorrow if her income shock was y j today. This yields c(a i,y j) = c(a i,y j), a function not defined on the grid points. This is the endogenous grid and it changes on each iteration. G. Violante, Global Methods p. 24 /29

EGM: Algorithm 6. Let a 0 be the value of asset holdings that induces the borrowing constraint to bind next period, i.e., the value for a that solves that equation at the point a 0, the lower bound of the grid. 7. Now we need to update our guess defined on the original grid. To get new guess ĉ 1 (a i,y j ) on grid points a i > a 0 we can use simple linear interpolation methods using values for { c(a n,y j ),c ( )} a n+1,y j on the two most adjacent values { } a n,a n+1 that bracket ai. If some points a i are beyond a m, the upper bound of the endogenous grid, just extend linearly the function G. Violante, Global Methods p. 25 /29

EGM: Algorithm To update the consumption policy function on grid values a i < a 0, we use the budget constraint: ĉ 1 (a i,y j ) = Ra i +y j a 0 since we cannot use the Euler equation as the borrowing constraint is binding for sure next period: the reason is that we found it was binding at a 0, therefore a fortiori it will be binding for a i < a 0. 8. Check convergence as before. G. Violante, Global Methods p. 26 /29

Envelope condition method (ECM) It is an alternative method that, in some cases, like the EGM, avoids the use of nonlinear solvers 1. Construct a grid on a with K +1 points: call it A. 2. Guess a value function ˆV 0 (a,y j ) = K k=0 w0 kj B k(a) where B k are cubic splines. 3. Compute the derivative of the value function on the nodes of A: ˆV 0 (a i,y j ) = K wkjb 0 k(a i ) k=0 Note: if you wish to use B 1 splines instead, you need to use a different grid in the above step because ˆV 0 is not differentiable on the nodes of the original grid A G. Violante, Global Methods p. 27 /29

Envelope Condition Method (ECM) 5. For any pair {a i,y j } on A Y construct the envelope condition: ˆV 0 (a i,y j ) = u c (Ra i +y j â 0 (a i,y j ))R from which we can obtain: â 0 (a i,y j ) = Ra i +y j u 1 c ( ) ˆV 0 (a i,y j ) R On each point of the grid we must verify if the borrowing constraint binds and if it does, we set â 0 (a i,y j ) = 0. 6. Update the value function from the Bellman equation. For each point of the grid A compute: ˆV 1 (a i,y j ) = u(ra i +y j â 0 (a i,y j ))+β y j Y π(y j y j ) ˆV 0 (â 0 (a i,y j ),y j ) G. Violante, Global Methods p. 28 /29

Envelope Condition Method (ECM) In practice, need to solve (K +1)J equations in (K +1)J { } coefficients wkj 1 of the type: K wkjb 1 k (a i ) = u(ra i +y j â 0 (a i,y j )) k=0 +β K π(y j y j ) wkj 0 B k(â 0 (a i,y j )) y j Y k=0 for all gridpoints, i = 0,1,...K and j = 1,2,...,J It is a linear system of equations G. Violante, Global Methods p. 29 /29