PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Similar documents
General Linear Least-Squares and Nonlinear Regression

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

and A L T O S O L O LOWELL, MICHIGAN, THURSDAY, OCTCBER Mrs. Thomas' Young Men Good Bye 66 Long Illness Have Sport in

A First Course on Kinetics and Reaction Engineering Supplemental Unit S4. Numerically Fitting Models to Data

Parallel Circuits. Chapter

Chapter 4 Mathematics of Cryptography

Fault Tolerant Computing CS 530DL

SECTION 7: CURVE FITTING. MAE 4020/5020 Numerical Methods with MATLAB

Scientific Computing. Roots of Equations

r/lt.i Ml s." ifcr ' W ATI II. The fnncrnl.icniccs of Mr*. John We mil uppn our tcpiiblicnn rcprc Died.

.-I;-;;, '.-irc'afr?*. P ublic Notices. TiffiATRE, H. aiety

W i n t e r r e m e m b e r t h e W O O L L E N S. W rite to the M anageress RIDGE LAUNDRY, ST. H E LE N S. A uction Sale.

H A M M IG K S L IM IT E D, ' i. - I f

Periodic Relationships Among the Elements

Chapter 4 ENERGY ANALYSIS OF CLOSED SYSTEMS

Physics of Everyday Phenomena. Chapter 2

Project One: C Bump functions

1. Partial Fraction Expansion All the polynomials in this note are assumed to be complex polynomials.

Polynomial Regression Model

Polynomial Division. You may also see this kind of problem written like this: Perform the division x2 +2x 3

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Some Notes on Least Squares, QR-factorization, SVD and Fitting

LOWELL WEEKLY JOURNAL.

( ) y 2! 4. ( )( y! 2)

Mass Relationships in Chemical Reactions

Curve Fitting. Least Squares Regression. Linear Regression

Chapter 8 Linear Algebraic Equations

Mass Relationships in Chemical Reactions

Mifflin County School District Planned Instruction

ONE DIMENSIONAL TRIANGULAR FIN EXPERIMENT. Current Technical Advisor: Dr. Kelly O. Homan Original Technical Advisor: Dr. D.C. Look

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

ENERGY ANALYSIS OF CLOSED SYSTEMS

ACCEPTS HUGE FLORAL KEY TO LOWELL. Mrs, Walter Laid to Rest Yesterday

Chapter 12 - Solved Problems

2D Plotting with Matlab

Chapter 2 Prerequisite Skills BLM Evaluate Functions 1. Given P(x) = x 4 3x 2 + 5x 11, evaluate.

Chapter 4: Designing Combinational Systems Uchechukwu Ofoegbu

Physics of Everyday Phenomena. Chapter 14

Mass Relationships in Chemical Reactions

NP-Complete Problems. More reductions

Operations Management

Curve Fitting and Interpolation

Mass Relationships in Chemical Reactions

Appendix F. + 1 Ma 1. 2 Ma Ma Ma ln + K = 0 (4-173)

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test III. Rebecca A. Simmons & Michael R. Gustafson II

Lab 13: Ordinary Differential Equations

Electron Configuration and Chemical Periodicity

Introduction. Chapter 1. The Study of Chemistry. The scientific method is a systematic approach to research

Cancer: DNA Synthesis, Mitosis, and Meiosis

Numerical Analysis Fall. Roots: Open Methods

Least squares regression

Section 4.1 Polynomial Functions and Models. Copyright 2013 Pearson Education, Inc. All rights reserved

Chapter 1 Welcome Aboard

Chapter 7 Statistics, Probability, and Interpolation

Linear Inverse Problems. A MATLAB Tutorial Presented by Johnny Samuels

2007 The McGraw-Hill Companies, Inc. All rights reserved.

Chapter 3 PROPERTIES OF PURE SUBSTANCES

SOLUTIONS to Exercises from Optimization

Chemical Equilibrium. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter 3 PROPERTIES OF PURE SUBSTANCES

BJEST. Function: Usage:

Chapter 3. Chapter 3

Chemistry: The Study of Change

Math Tutor: Algebra Skills

RINGS HAVING ZERO-DIVISOR GRAPHS OF SMALL DIAMETER OR LARGE GIRTH. S.B. Mulay

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2 Solutions. Michael R. Gustafson II

White Light. Chapter 7 Electron Structure of the Atom

Chemical Bonding II: Molecular Geometry and Hybridization of Atomic Orbitals Chapter 1

#A31 INTEGERS 18 (2018) A NOTE ON FINITE SUMS OF PRODUCTS OF BERNSTEIN BASIS POLYNOMIALS AND HYPERGEOMETRIC POLYNOMIALS

Algebra II Practice. Dr. Barbara Sandall, Ed.D. Travis Olson, M.S.

Cells Divide, and Cells Die

CTB/McGraw-Hill wks Test ID:

Mifflin County School District Planned Instruction

Chapter 1 Image Slides. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

CBE507 LECTURE III Controller Design Using State-space Methods. Professor Dae Ryook Yang

A First Course on Kinetics and Reaction Engineering Example S6.2

Chapter 2 HEAT CONDUCTION EQUATION

Chapter 2 HEAT CONDUCTION EQUATION

Nonlinear Regression Functions

DonnishJournals

PROPERTIES OF PURE SUBSTANCES. Chapter 3. Mehmet Kanoglu. Thermodynamics: An Engineering Approach, 6 th Edition. Yunus A. Cengel, Michael A.

Green s Functions with Reflection

Contents 16. Higher Degree Equations

Outline. The Nature of Molecules. Atomic Structure. Atomic Structure. All matter is composed of atoms.

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line?

MATLAB BASICS. Instructor: Prof. Shahrouk Ahmadi. TA: Kartik Bulusu

CS 221 Lecture 9. Tuesday, 1 November 2011

Periodic Relationships Among the Elements

Foundations of Cryptography

Chapter 2. Polynomial and Rational Functions. 2.6 Rational Functions and Their Graphs. Copyright 2014, 2010, 2007 Pearson Education, Inc.

COMPUTER SESSION: ARMA PROCESSES

Prime and irreducible elements of the ring of integers modulo n

An introduction to plotting data

Transcription:

Part 4 Chapter 14 General Linear Least-Squares ares and Nonlinear Regression PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter Objectives Knowing how to implement polynomial regression. Knowing how to implement multiple linear regression. Understanding the formulation of the general linear least-squares model. Understanding di how the general linear leastsquares model can be solved with MATLAB using either the normal equations or left division. Understanding how to implement nonlinear regression with optimization techniques.

Polynomial Regression The least-squares procedure from Chapter 13 can be readily extended to fit data to a higher-order polynomial. Again, the idea is to minimize the sum of the squares of the estimate residuals. The figure shows the same data fit with: a) Afi first order polynomial l b) A second order polynomial

Process and Measures of Fit For a second order polynomial, the best fit would mean minimizing: n n 2 S r = e i = 2 y i a 0 a 1 x i a 2 x i i=1 ( ) 2 In general, this would mean minimizing: n S r = 2 e i = i=1 n i=1 i=1 ( y i a 0 a 1 x i a 2 x 2 m i a m x ) 2 i The standard d error for fitting an m th order polynomial l to n data points is: S s y/ x = r n m +1 ( ) because the m th order polynomial has (m+1) coefficients. The coefficient of determination r 2 is still found using: r 2 = S t S r S t

Multiple Linear Regression Another useful extension of linear regression is the case where y is a linear function of two or more independent variables: y = a 0 + a 1 x 1 + a 2 x 2 + a m x m Again, the best fit is obtained by minimizing the sum of the squares of the estimate residuals: n 2 S r = e i = n i=1 1 i=1 1 ( y i a 0 a 1 x 1,i a 2 x 2,i a m x m,i ) 2

General Linear Least Squares Linear, polynomial, and multiple linear regression all belong to the general linear least-squares model: y = a 0 z 0 + a 1 z 1 + a 2 z 2 + a m z m + e where z 0, z 1,, z m are a set of m+1 1 basis functions and e is the error of the fit. The basis functions can be any function data but cannot contain any of the coefficients a 0, a 1, etc.

Solving General Linear Least The equation: Squares Coefficients y = a z + a z + a z 0 + a z 0 1 1 2 2 m m + e can be re-written for each data point as a matrix equation: { y}= [ Z] { a}+ {} e where {y} contains the dependent data, {a} contains the coefficients of the equation, {e} contains the error at each point, and [Z] is: z 01 z 11 z m1 []= Z z 02 z 12 z m2 z 0n z 1n z mn with z ji representing the the value of the j th basis function calculated at the i th point.

Solving General Linear Least Squares Coefficients Generally, [Z] is not a square matrix, so simple inversion cannot be used to solve for {a}. Instead the sum of the squares of the estimate residuals is minimized: n n m S 2 r = e i = y i a j z ji i=1 i=1 j=0 The outcome of this minimization yields: [[] Z T [] Z ] a { } {}= [] Z T {} y 2

MATLAB Example Given x and y data in columns, solve for the coefficients of the best fit line for y=a 0 +a 1 x+a 2 x 2 Z = [ones(size(x) x x.^2] a = (Z *Z)\(Z *y) Note also that MATLAB s left-divide will automatically include the [Z] T terms if the matrix is not square, so a = Z\y would work as well To calculate measures of fit: St = sum((y-mean(y)).^2) Sr = sum((y-z*a).^2) r2 = 1-Sr/St syx = sqrt(sr/(length(x)-length(a)))

Nonlinear Regression As seen in the previous chapter, not all fits are linear equations of coefficients and basis functions. One method to handle this is to transform the variables and solve for the best fit of the transformed variables. There are two problems with this method: Not all equations can be transformed easily or at all The best fit line represents the best fit for the transformed variables, not the original variables. Another method is to perform nonlinear regression to directly determine the least-squares fit.

Nonlinear Regression in MATLAB To perform nonlinear regression in MATLAB, write a function that returns the sum of the squares of the estimate residuals for a fit and then use MATLAB s fminsearch function to find the values of the coefficients where a minimum occurs. The arguments to the function to compute S r should be the coefficients, the independent variables, and the dependent variables.

Nonlinear Regression in MATLAB Example Given dependent force data F for independent velocity data v, determine the coefficients for the fit: F = a 0 v a 1 First - write a function called fssr.m containing the following: function f = fssr(a, xm, ym) yp = a(1)*xm. ^a(2) a(2); f = sum((ym-yp).^2); Then, use fminsearch in the command window to obtain the values of a that minimize fssr: a = fminsearch(@fssr, [1, 1], [], v, F) where [1, 1] is an initial iti guess for the [a0, a1] vector, [] is a placeholder for the options

Nonlinear Regression Results The resulting coefficients will produce the largest r 2 for the data and may be different from the coefficients produced by a transformation: