Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.

Slides:



Advertisements
Similar presentations
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
Advertisements

Chapter 10 Curve Fitting and Regression Analysis
Regression Analysis Using Excel. Econometrics Econometrics is simply the statistical analysis of economic phenomena Here, we just summarize some of the.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
CITS2401 Computer Analysis & Visualisation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Ordinary Differential Equations Equations which are.
Curve Fitting and Interpolation: Lecture (IV)
Curve-Fitting Regression
General Linear Least-Squares and Nonlinear Regression
Part 4 Chapter 13 Linear Regression
Polynomial Interpolation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 181 Interpolation Chapter 18 Estimation of intermediate.
Probability & Statistics for Engineers & Scientists, by Walpole, Myers, Myers & Ye ~ Chapter 11 Notes Class notes for ISE 201 San Jose State University.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 CURVE.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 181 Interpolation.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Interpolation Chapter 18.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 Least.
Linear Simultaneous Equations
Chapter 5 Plotting Data Curve Fitting, Good Graphing Practices Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simple Linear Regression Analysis
Section 1.2 Homework questions? Slide 1 Copyright (c) The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Image Slides.
Non-Linear Simultaneous Equations
Chapter 8 Traffic-Analysis Techniques. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8-1.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Numerical Differentiation and Integration Part 6 Calculus.
Least-Squares Regression
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS.
Introduction to MATLAB for Engineers, Third Edition Chapter 6 Model Building and Regression PowerPoint to accompany Copyright © The McGraw-Hill Companies,
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.
Recap Summary of Chapter 6 Interpolation Linear Interpolation.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Curve Fitting and Regression EEE 244. Descriptive Statistics in MATLAB MATLAB has several built-in commands to compute and display descriptive statistics.
Part 4 Chapter 17 Polynomial Interpolation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Today’s class Spline Interpolation Quadratic Spline Cubic Spline Fourier Approximation Numerical Methods Lecture 21 Prof. Jinbo Bi CSE, UConn 1.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Mark Dugopolski Elementary Algebra Edition 3 Chapter 7 Systems of Linear Equations and Inequalities Copyright © 2000 by the McGraw-Hill Companies, Inc.
ES 240: Scientific and Engineering Computation. Chapter 13: Linear Regression 13. 1: Statistical Review Uchechukwu Ofoegbu Temple University.
Curve-Fitting Regression
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 9 Linear Systems of Equations: Gauss Elimination.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 22.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3- Chapter 12 Iterative Methods.
Lecture 16 - Approximation Methods CVEN 302 July 15, 2002.
Ch14: Linear Least Squares 14.1: INTRO: Fitting a pth-order polynomial will require finding (p+1) coefficients from the data. Thus, a straight line (p=1)
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
Chapter 13. General Least-Squares and Nonlinear Regression Gab-Byung Chae.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 27.
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Simple Linear Regression Analysis Chapter 13.
Curve Fitting Introduction Least-Squares Regression Linear Regression Polynomial Regression Multiple Linear Regression Today’s class Numerical Methods.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Recap Functions with No input OR No output Determining The Number of Input and Output Arguments Local Variables Global Variables Creating ToolBox of Functions.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
Chapter 13 Transportation Demand Analysis. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display
Copyright © 2014, The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Applied Numerical Methods With MATLAB ® for Engineers.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 21 Numerical Differentiation.
Lecture 29: Modeling Data. Data Modeling Interpolate between data points, using either linear or cubic spline models Model a set of data points as a polynomial.
MATLAB for Engineers 3E, by Holly Moore. © 2011 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Part 5 - Chapter
Part 5 - Chapter 17.
Chapter 12 Curve Fitting : Fitting a Straight Line Gab-Byung Chae
Part 5 - Chapter 17.
Today’s class Multiple Variable Linear Regression
Linear regression Fitting a straight line to observations.
General Linear Least-Squares and Nonlinear Regression
Discrete Least Squares Approximation
Presentation transcript:

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear Regression

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Part Organization Chapter 14 –Brief Review of Statistics –Linear Regression (How to determine the best fit) –Linearization of Nonlinear Equations Chapter 15 –Polynomial Regression –Multiple Linear Regression Chapter 16 – Skip Chapter 17 – Interpolating Chapter 18 – Spline Interpolation 2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3 Chapter 15 – General Least Squares Some engineering data is poorly represented by a straight line. For these cases a curve is better suited to fit the data. –In chapter 14 we looked at techniques to linearize other models –This approach allowed us to use linear regression –An alternate approach is to use polynomial regression

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 Taylor’s Theorem Recall that any smooth function can be approximated by a polynomial Polynomial regression fits a polynomial to a set of data points

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5 General Linear Least Squares Minimized by taking its partial derivative w.r.t. each of the coefficients and setting the resulting equation equal to zero

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. For Simple Linear Regression 6

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 7 Least-Squares Fit of a Straight Line To minimize Sr, we need to find the partial derivatives with respect to a0 and a1 and set them equal to 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Coefficients for a Simple Linear Regression 8

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. For 2 nd Order Polynomial Regression 9

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example Fit this data to a second order polynomial

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. As before we need to minimize the sum of the squares of the residuals 11 Take the derivatives with respect to the coefficients (a) and set them equal to 0

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3 equations and 3 unknowns 12

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. This is starting to get cumbersome We could solve for the coefficients using matrix algebra 13

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

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. This is starting to get cumbersome We could solve for the coefficients using matrix algebra…. But… we could also use the built-in MATLAB function polyfit 16

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 18 polyfit has the advantage that you can use it for higher order polynomials

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Or use left division 19

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 20 General Linear Least Squares Minimized by taking its partial derivative w.r.t. each of the coefficients and setting the resulting equation equal to zero

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. For 2 nd Order Polynomial Regression 21

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display a 0 * 1 + a 1 * 0 + a 2 * 0 a 0 * 1 + a 1 * 1 + a 2 * 1 a 0 * 1 + a 1 * 2 + a 2 * 4 a 0 * 1 + a 1 * 3 + a 2 * 9 a 0 * 1 + a 1 * 4 + a 2 * 16 a 0 * 1 + a 1 * 5 + a 2 * 25 =

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display a 0 * 1 + a 1 * 0 + a 2 * 0 a 0 * 1 + a 1 * 1 + a 2 * 1 a 0 * 1 + a 1 * 2 + a 2 * 4 a 0 * 1 + a 1 * 3 + a 2 * 9 a 0 * 1 + a 1 * 4 + a 2 * 16 a 0 * 1 + a 1 * 5 + a 2 * 25 = If you have an equal number of equations and unknowns the \ operator uses a modified Gaussian elimination strategy

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display a 0 * 1 + a 1 * 0 + a 2 * 0 a 0 * 1 + a 1 * 1 + a 2 * 1 a 0 * 1 + a 1 * 2 + a 2 * 4 a 0 * 1 + a 1 * 3 + a 2 * 9 a 0 * 1 + a 1 * 4 + a 2 * 16 a 0 * 1 + a 1 * 5 + a 2 * 25 = If you have more equations than unknowns the system is over-specified, and the \ operator utilizes QR factorization to find the best fit

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 25 The General Linear Least Squares Technique can be applied to more than just polynomials Minimized by taking its partial derivative w.r.t. each of the coefficients and setting the resulting equation equal to zero

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. What if you want to do a multiple linear regression? 26 Use a similar approach as that outlined in Section 15.2

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 27 This is pretty complicated, and it’s only good for 2 variables plus a constant!

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 28 This does the same thing, generalized for m dimensions

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Or… use left division 29

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Or… use left division a 0 * 1 + a 1 * 0 + a 2 * 0 a 0 * 1 + a 1 * 2 + a 2 * 1 a 0 * 1 + a 1 * a 2 * 2 a 0 * 1 + a 1 * 1 + a 2 * 3 a 0 * 1 + a 1 * 4 + a 2 * 6 a 0 * 1 + a 1 * 7 + a 2 * 2 = QR Factorization

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Using the Interactive Curve Fitting Tools MATLAB 7 includes interactive plotting tools. They include –basic curve fitting, –more complicated curve fitting –statistical tools

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Use the curve fitting tools… Create a graph Making sure that the figure window is the active window select –Tools-> Basic Fitting –The basic fitting window will open on top of the plot

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

Plot generated using the Basic Fitting Window

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Residuals are the difference between the actual and calculated data points

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Basic Fitting Window

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Data Statistics Window You can also access the data statistics window from the figure menu bar. Select Tools->Data Statistics from the figure window. This window allows you to calculate statistical functions interactively, such as mean and standard deviation, based on the data in the figure, and allows you to save the results to the workspace.

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Save to your Current Directory 39

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Reload a figure by double clicking it’s name in the current directory 40

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Or in the command window 41