Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.

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

6-1 Introduction To Empirical Models 6-1 Introduction To Empirical Models.
Chapter 10 Curve Fitting and Regression Analysis
Objectives (BPS chapter 24)
P M V Subbarao Professor Mechanical Engineering Department
Copyright © 2008 by the McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Managerial Economics, 9e Managerial Economics Thomas Maurice.
Chapter 10 Simple Regression.
Curve Fitting and Interpolation: Lecture (IV)
Function Approximation
Least Square Regression
Curve-Fitting Regression
Least Square Regression
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 17 Least Square Regression.
Part 4 Chapter 13 Linear Regression
SIMPLE LINEAR REGRESSION
Engineering Computation Curve Fitting 1 Curve Fitting By Least-Squares Regression and Spline Interpolation Part 7.
Probability & Statistics for Engineers & Scientists, by Walpole, Myers, Myers & Ye ~ Chapter 11 Notes Class notes for ISE 201 San Jose State University.
Simple Linear Regression Analysis
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 CURVE.
SIMPLE LINEAR REGRESSION
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 Least.
Correlation and Regression Analysis
Simple Linear Regression Analysis
Relationships Among Variables
Calibration & Curve Fitting
1 Doing Statistics for Business Doing Statistics for Business Data, Inference, and Decision Making Marilyn K. Pelosi Theresa M. Sandifer Chapter 11 Regression.
SIMPLE LINEAR REGRESSION
Least-Squares Regression
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
Introduction to Linear Regression and Correlation Analysis
Inference for regression - Simple linear regression
CPE 619 Simple Linear Regression Models Aleksandar Milenković The LaCASA Laboratory Electrical and Computer Engineering Department The University of Alabama.
Simple Linear Regression Models
3/2003 Rev 1 I – slide 1 of 33 Session I Part I Review of Fundamentals Module 2Basic Physics and Mathematics Used in Radiation Protection.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Applied Quantitative Analysis and Practices LECTURE#23 By Dr. Osman Sadiq Paracha.
Curve Fitting and Regression EEE 244. Descriptive Statistics in MATLAB MATLAB has several built-in commands to compute and display descriptive statistics.
Chapter 8 Curve Fitting.
ES 240: Scientific and Engineering Computation. Chapter 13: Linear Regression 13. 1: Statistical Review Uchechukwu Ofoegbu Temple University.
Curve-Fitting Regression
CHAPTER 3 Model Fitting. Introduction Possible tasks when analyzing a collection of data points: Fitting a selected model type or types to the data Choosing.
Copyright © 2005 by the McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Managerial Economics Thomas Maurice eighth edition Chapter 4.
Inference for Regression Simple Linear Regression IPS Chapter 10.1 © 2009 W.H. Freeman and Company.
© Copyright McGraw-Hill Correlation and Regression CHAPTER 10.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
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.
Copyright © 2011 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Multiple Regression Chapter 14.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Applied Numerical Methods With MATLAB ® for Engineers.
The simple linear regression model and parameter estimation
Chapter 4: Basic Estimation Techniques
Chapter 4 Basic Estimation Techniques
Part 5 - Chapter
Part 5 - Chapter 17.
Basic Estimation Techniques
Correlation and Simple Linear Regression
Basic Estimation Techniques
CHAPTER 29: Multiple Regression*
Chapter 12 Curve Fitting : Fitting a Straight Line Gab-Byung Chae
Part 5 - Chapter 17.
Linear regression Fitting a straight line to observations.
Correlation and Simple Linear Regression
Simple Linear Regression
Discrete Least Squares Approximation
SIMPLE LINEAR REGRESSION
Simple Linear Regression and Correlation
Least Square Regression
SIMPLE LINEAR REGRESSION
SKTN 2393 Numerical Methods for Nuclear Engineers
Presentation transcript:

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Describes techniques to fit curves (curve fitting) to discrete data to obtain intermediate estimates. There are two general approaches two curve fitting: –Data exhibit a significant degree of scatter. The strategy is to derive a single curve that represents the general trend of the data. –Data is very precise. The strategy is to pass a curve or a series of curves through each of the points. 2 Part 4 CURVE FITTING

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Easiest Approach is “Eyeballing” If the data has scatter –Try to fit a straight line or curve to the data If the data is precise –Connect all the data with straight lines –Try to capture the shape of the data with curves 3 We’d like to develop an approach that is less qualitative

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. No matter how you model the data In engineering two types of applications are encountered: –Trend analysis. Predicting values of dependent variable, may include extrapolation beyond data points or interpolation between data points. –Hypothesis testing. Comparing existing mathematical model with measured data. 4 Before we do either we’ll need to develop some mathematical background

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Part Organization Chapter 14 –Brief Review of Statistics –Linear Regression Chapter 15 –Polynomial Regression –Multiple Linear Regression Chapter 16 – Skip Chapter 17 –Polynomial Interpolation Chapter 18 –Spline and Piecewise Interpolation 5 Creating a best fit mathematical model of the data that doesn’t necessarily pass through every point Passing a line or curve through each of the points

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 6 Part 4 Chapter 14 Linear Regression

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.Review of Statistics 2.Introduction to linear regression 7

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 8 Mathematical Background Simple Statistics Statistics are widely used to describe engineering data We’ll start out by describing the most useful of these parameters Note: In these first examples we are talking about one parameter – not how a dependent variable changes with an independent variable – that comes later

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. These descriptive statistics are most often selected to represent –The location of the center of the distribution of the data, –The degree of spread of the data. 9

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Arithmetic mean (the average) 10 The sum of the individual data points (y i ) divided by the number of points (n).

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Table 14.2 Measurements of the coefficient of thermal expansion of structural steel.

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

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Standard deviation. The most common measure of the spread in a sample. or 14 Sum of the squares of the residuals Standard Deviation Variance More convenient because you don’t have to precalculate the mean

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 15 Variance. Representation of spread - it’s the square of the standard deviation. Coefficient of variation – a representation of the spread as a percentage, based on the average. Degrees of freedom

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 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. Histograms 18 Figure 14.3

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 20 Defaults to 10 bins

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Random Numbers MATLAB includes functions to generate random numbers rand –Random uniformly distributed numbers between 0 and 1 randn –Random numbers normally distributed with a mean of 0 and a standard deviation of 1 21

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Uniform Random Numbers rand R = rand(m,n) –Generates an m by n matrix of uniformly distributed numbers between 0 and 1 Runiform = low + (up – low)*rand(m,n) 22

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example 14.2 If the initial velocity is 0, the downward velocity of the free-falling bungee jumper can be predicted with the following analytical solution 23

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Suppose that  g=9.81 m/s^2  m=68.1 kg  t = 4 sec  Cd is unknown,  but it varies uniformly between and 0.275…  ie +/- 10% around kg/m.  Use the rand function to generate 1000 values of Cd  Study how v varies 24

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

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

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

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

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

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

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 32 Part 4 Chapter 14 Linear Regression

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.Review of Statistics 2.Introduction to linear regression 33

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 34 Linear Least Squares Regression Linear Regression Fitting a straight line to a set of paired observations: (x 1, y 1 ), (x 2, y 2 ),…,(x n, y n ). a 0 - intercept a 1 - slope

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 35 Linear Least Squares Regression We can get an idea of how good the fit is by comparing the predicted values of y to the measured y values e- error, or residual, between the model and the observations

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 36 What is the criteria for a “Best” Fit? Minimize the sum of the residual errors for all available data: n = total number of points However, this is an inadequate criterion, so is the sum of the absolute values of the residual

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 37 Minimizes the error of any one point Any straight line within the dashed lines will minimize the sum of the absolute value of the residuals

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 38 Best strategy is to minimize the sum of the squares of the residuals between the measured y and the y calculated with the linear model: Yields a unique line for a given set of data.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 39 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. 40 Least-Squares Fit of a Straight Line Mean Values 2 equations and 2 unknowns

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Example 14.4 Force vs. Wind Velocity in a Wind Tunnel Fit a straight line to the x and y values of the data in Table V, m/s F, N

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. First let’s plot the data

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 44 Finds the best fit line and plots it

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Quantification of the Error of Linear Regression 46

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Standard Error 47 Quantifies the spread around the regression line as opposed to the standard deviation, which quantifies the spread around a mean value Similar to the standard deviation

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Standard Error of the Estimate Regression data showing (a) the spread of data around the mean of the dependent data and (b) the spread of the data around the best fit line: The reduction in spread represents the improvement due to linear regression.

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Correlation Coefficient 49 r is a measure of the goodness of the fit When r = 1 the fit is perfect Sum of the squares of the error – the difference between the true value and the predicted value Sum of the squares of the difference between the measured value and the mean

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. What is the correlation coefficient, R? 50 It’s a measure of how good a fit you’ve got. If R = 1 the fit is perfect. If R=0 it’s just the average of the y values.

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 52 Determines how ‘good’ the fit is

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. It might be useful to make this into a function 53 Notice this is a modified version of the algorithm shown in figure 14.15

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Or… we could use the built-in MATLAB functions 54

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 55 MATLAB Syntax Our book’s Syntax

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Using Left Division to find the coefficients 57

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. What if we want to force the fit through 0? The physics of the situation might dictate that if:  x is equal to 0  y must equal 0  For example  If the wind velocity is 0  The force on the object in the wind tunnel must be 0 59

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

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

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 63 Part 4 Chapter 14 Linear Regression

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Linearization of Non-linear Relationships It is often useful to transform non-linear relations so that they plot as a straight line. 64

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

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

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Consider the data plotted on the right Notice that it appears to be a straight line when plotted on a log-log scale This leads us to believe it might best be modeled using a power equation 68

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Data to be fit to a power equation – from Chapra’s other text Table 17_03.jpg

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

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

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

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

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Number of similar problems in the homework Strategy to determine the appropriate model –Plot the data on an xy scatter plot –Plot the data on a semilog scatter plot –Plot the data on a loglog scatter plot –Plot 1/x vs 1/y on an xy scatter plot Once you’ve determined the model type, find the constants using linear regression. 74