Least Squares Regression

Similar documents
Solving Quadratic Equations

Least-Squares Regression

CHALLENGE! (0) = 5. Construct a polynomial with the following behavior at x = 0:

(x + 1)(x 2) = 4. x

Understand the vocabulary used to describe polynomials Add polynomials Subtract polynomials Graph equations defined by polynomials of degree 2

Tropical Polynomials

Chapter 7 Rational Expressions, Equations, and Functions

Introduction. Adding and Subtracting Polynomials

3.5. Dividing Polynomials. LEARN ABOUT the Math. Selecting a strategy to divide a polynomial by a binomial

Functions - Exponential Functions

e x = 1 + x + x2 2! + x3 If the function f(x) can be written as a power series on an interval I, then the power series is of the form

The Sommerfeld Polynomial Method: Harmonic Oscillator Example

Math RE - Calculus II Antiderivatives and the Indefinite Integral Page 1 of 5

The Derivative of a Function Measuring Rates of Change of a function. Secant line. f(x) f(x 0 ) Average rate of change of with respect to over,

a factors The exponential 0 is a special case. If b is any nonzero real number, then

Math 0320 Final Exam Review

How might we evaluate this? Suppose that, by some good luck, we knew that. x 2 5. x 2 dx 5

2012 Texas Essential Knowledge and Skills for Algebra II in Pearson Texas Algebra II

Systems of Linear ODEs

Algebra II Assessment. Eligible Texas Essential Knowledge and Skills

7x 5 x 2 x + 2. = 7x 5. (x + 1)(x 2). 4 x

Exponential and. Logarithmic Functions. Exponential Functions. Logarithmic Functions

1 Solving Algebraic Equations

Jim Lambers MAT 419/519 Summer Session Lecture 13 Notes

MATH 408N PRACTICE MIDTERM 1

Equations with regular-singular points (Sect. 5.5).

Radicals: To simplify means that 1) no radicand has a perfect square factor and 2) there is no radical in the denominator (rationalize).

Lecture 3: Multiple Regression

1. The dosage in milligrams D of a heartworm preventive for a dog who weighs X pounds is given by D x. Substitute 28 in place of x to get:

SUMMATION TECHNIQUES

Using Scientific Notation

Exponents and Polynomials. (5) Page 459 #15 43 Second Column; Page 466 #6 30 Fourth Column

Mathematics 104 Fall Term 2006 Solutions to Final Exam. sin(ln t) dt = e x sin(x) dx.

Equations in Quadratic Form

Alg 1B Chapter 7 Final Exam Review

Definition of a Logarithm

The greatest common factor, or GCF, is the largest factor that two or more terms share.

Semester Review Packet

FastTrack - MA109. Exponents and Review of Polynomials

Calculus (Math 1A) Lecture 4

Calculus (Math 1A) Lecture 4

Ch. 7.6 Squares, Squaring & Parabolas

A quadratic expression is a mathematical expression that can be written in the form 2

Unit 3 Vocabulary. An algebraic expression that can contains. variables, numbers and operators (like +, An equation is a math sentence stating

Math Boot Camp Functions and Algebra

Series Solutions of Differential Equations

Polynomials. Exponents. End Behavior. Writing. Solving Factoring. Graphing. End Behavior. Polynomial Notes. Synthetic Division.

SUMMER REVIEW PACKET. Name:

Definition of a Logarithm

Section 3.7: Solving Radical Equations

Skill 6 Exponential and Logarithmic Functions

Power Series Solutions We use power series to solve second order differential equations

College Algebra. Chapter 5 Review Created by: Lauren Atkinson. Math Coordinator, Mary Stangler Center for Academic Success

QUADRATIC FUNCTIONS AND MODELS

1.5 F15 O Brien. 1.5: Linear Equations and Inequalities

1.2. Indices. Introduction. Prerequisites. Learning Outcomes

Midterm Review. Igor Yanovsky (Math 151A TA)

Integration of Rational Functions by Partial Fractions

Midterm for Introduction to Numerical Analysis I, AMSC/CMSC 466, on 10/29/2015

Math 10b Ch. 8 Reading 1: Introduction to Taylor Polynomials

Math 3 Variable Manipulation Part 3 Polynomials A

A VERTICAL LOOK AT KEY CONCEPTS AND PROCEDURES ALGEBRA I

6.6 General Form of the Equation for a Linear Relation

Algebra Performance Level Descriptors

Graphing Linear Inequalities

Math 1302 Notes 2. How many solutions? What type of solution in the real number system? What kind of equation is it?

High School Programs. Math 2 II UNIT 2 OVERVIEW: Modeling with Quadratic Functions Parent Guide

Math 4377/6308 Advanced Linear Algebra I Dr. Vaughn Climenhaga, PGH 651A HOMEWORK 3

P.5 Solving Equations

Minimizing & Maximizing Functions

Econ Slides from Lecture 7

Find two positive factors of 24 whose sum is 10. Make an organized list.

x is also called the abscissa y is also called the ordinate "If you can create a t-table, you can graph anything!"

f(g(x)) g (x) dx = f(u) du.

Essential Mathematics

evaluate functions, expressed in function notation, given one or more elements in their domains

Chapter 2. First-Order Differential Equations

Unit 1 Vocabulary. A function that contains 1 or more or terms. The variables may be to any non-negative power.

Sections 6.1 and 6.2: Systems of Linear Equations

MATH 190 KHAN ACADEMY VIDEOS

Definition of a Logarithm

Ch 5.7: Series Solutions Near a Regular Singular Point, Part II

Agile Mind Algebra I Scope and Sequence, Texas Essential Knowledge and Skills for Mathematics

Chapter Six. Polynomials. Properties of Exponents Algebraic Expressions Addition, Subtraction, and Multiplication Factoring Solving by Factoring

Support Vector Machines and Bayes Regression

Before we do that, I need to show you another way of writing an exponential. We all know 5² = 25. Another way of writing that is: log

Review 1. 1 Relations and Functions. Review Problems

Math Final Exam Review

Solutions to Math 53 First Exam April 20, 2010

Homework #6 Solutions

CHAPTER 1 POLYNOMIALS

Algebra I Number and Quantity The Real Number System (N-RN)

Math-2. Lesson 1-2 Solving Single-Unknown Linear Equations

NAME DATE PERIOD. A negative exponent is the result of repeated division. Extending the pattern below shows that 4 1 = 1 4 or 1. Example: 6 4 = 1 6 4

1.1 Basic Algebra. 1.2 Equations and Inequalities. 1.3 Systems of Equations

Math 2142 Homework 5 Part 1 Solutions

Ma 530 Power Series II

Logarithmic and Exponential Equations and Change-of-Base

Introduction to Series and Sequences Math 121 Calculus II Spring 2015

Adding & Subtracting Polynomial Expressions

Transcription:

Least Squares Regression Chemical Engineering 2450 - Numerical Methods Given N data points x i, y i, i 1 N, and a function that we wish to fit to these data points, fx, we define S as the sum of the squared errors as S [y i fx i ] 2 1 In words, we take the observed value at each data point eg, y 1 and subtract the function value at that point eg, fx 1 and we square that number We do this for each data point and add them all up Our goal is to minimize S by choosing the best values for the parameters in the function fx 1 Polynomials Let s consider the situation where fx in equation 1 is a polynomial, ie, n p fx a k x k, 2 where n p is the order of the polynomial Substituting 2 into 1, we obtain k1 S n p 2 y i a k x k 3 k0 Equation 3 has n p + 1 coefficients, a k, k 0 n p, which we want to change to minimize S To do this, we take partial derivatives of S with respect to each a k Given a polynomial form for fx, the general formula for this is a k n p 2x k i y i a j x j i k 0 n p 4 j0 To find the minimum of S with respect to the parameters a k, we solve a k 0 for all a k Note that the a k coefficients enter linearly in equation 4 That means that 4 represents a linear system of equations for the n p + 1 unknowns a k This regression technique is thus called linear least squares, and applies to any polynomial function We will consider other forms for fx in 2 1

11 Matrix Form 1 POLYNOMIALS 11 Matrix Form Equations 4 may also be written as A T Aφ A T b, 5 where A, φ, and b are given as 1 x 1 x 2 1 x np 1 1 x A 2 x 2 2 x np 2, φ 1 x N x 2 N xnp N a np, b y 1 y N The math to show this is a bit tedious, so we won t show it here However, in 12 we will go through this for linear polynomials 12 Linear Polynomials For a linear polynomial, 2 becomes fx + x and 3 becomes S y i x 2 6 We now need to obtain expressions for a 9 and From 4, we set k 0 and n p 1 to find Setting k 1 in 4 gives 2 y i x i 7 2x i y i x i 8 We would solve equations 7 and 8 for what values of and make the equations equal to zero In other words, we solve y i x i 0 9 x i y i x i 0 10 for and At that point we have found the values of and that minimize S 2

12 Linear Polynomials 1 POLYNOMIALS 121 Matrix Form We can write 9 and 10 in matrix form by rearranging them Recall that and are the unknowns Therefore, we rewrite the equations to define coefficients multiplying and as y i a N 0 1 + a 1 x i, x iy i a N 0 x i + a N 1 x2 i In matrix form this becomes [ N x i x i x2 i ] N y i x 11 iy i 122 What s with the? It scares me! Some of you may still be scared of using the notation, so let s derive this another way Starting from 6, let s expand the summation to find S y 1 x 1 2 + y 2 x 2 2 + + y N x N 2 Now we can express using the chain rule as 2 y 1 x 1 1 + 2 y 2 x 2 1 + + 2 y N x N 1, 2 y 1 x 1 2 y 2 x 2 2 y N x N 12 and we can find the same way as 2 y 1 x 1 x 1 + 2 y 2 x 2 x 2 + + 2 y N x N x N, 2x 1 y 1 x 1 2x 2 y 2 x 2 2x N y N x N 13 Comparing equations 7 and 8 with 12 and 13, we see that they are equivalent We solve 0 y 1 x 1 + y 2 x 2 + + y N x N, 0 x 1 y 1 x 1 + x 2 y 2 x 2 + + x N y N x N, for and This is equivalent to 9 and 10 Matrix Form We can rewrite these equations in matrix form as well We first collect terms on and to find y 1 + y 2 + + y N N + x 1 + x 2 + + x N, x 1 y 1 + x 2 y 2 + + x N y N x 1 + x 2 + + x N + x 2 1 + x 2 2 + + x 2 N 3

2 NONLINEAR LEAST SQUARES In matrix form we have [ N x 1 + x 2 + x N x 1 + x 2 + x N x 2 1 + x2 2 + + x2 N ] y 1 + y 2 + + y N x 1 y 1 + x 2 y 2 + + x N y N, which is equivalent to 11 2 Nonlinear Least Squares For situations where the form of fx is such that its parameters enter nonlinearly, we have nonlinear least squares regression We again start with equation 1, and differentiate it with respect to the parameters in fx Let s consider a simple example to illustrate this point 21 Example: Power-Law Functions Assume we have a function in the form fx ax b Here, the parameters are a and b and they enter nonlinearly into the equation they are multiplied and b is an exponent In this case 1 becomes S y i ax b i 2 Taking partial derivative of S with respect to the parameters a and b gives a b 2 y i ax b i x b i 2 2 y i ax b i ax b i ln x i x b i 2ab y i ax b i, x b 1 i y i ax b i We now have two nonlinear equations to solve simultaneously for a and b Specifically, we solve the equations x b i y i ax b i x b i ln x i y i ax b i 0, 0, for a and b These equations are nonlinear since we have b as an exponent and we have products of the unknowns a and b 4

21 Example: Power-Law Functions 2 NONLINEAR LEAST SQUARES 211 Rewriting as a Linear Least Squares Problem Nonlinear equations are typically much more difficult to solve than linear equations In some cases, functions that appear to require nonlinear regression can be rewritten to use linear regression Let s look at the function fx ax b again For convenience, write this as y ax b Now we take the natural log of each side to find ln y ln ax b, ln a + ln x b, ln a + b ln x Now let s define α ln a, x ln x, and ỹ ln y We now have ỹ α + b x, which is linear with respect to α and b This looks identical to the situation we discussed in 12 Now we can perform regression by solving 9 and 10 to obtain α and b Once we have the solution for α and b, we recover a by a exp α Now instead of solving nonlinear equations we can solve linear equations! This is not always the case, but in many situations it is 5