28 Pages

Lecture_04_Curve_Fitting_Linear_Regressi-1

Course: EGR 102, Spring 2012
School: Michigan State University
Rating:
 
 
 
 
 

Word Count: 1245

Document Preview

102 Introduction EGR to Engineering Modeling Curve Fitting Linear Regression Regression Chapter 14.1-14.3 Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw Hill EGR 102 Lecture 4 1 Objectives Become familiar with basic statistics and the normal distribution. Learn how to compute the slope and intercept of a best-fit straight line with linear regression. Learn how to compute and...

Register Now

Unformatted Document Excerpt

Coursehero >> Michigan >> Michigan State University >> EGR 102

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
102 Introduction EGR to Engineering Modeling Curve Fitting Linear Regression Regression Chapter 14.1-14.3 Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw Hill EGR 102 Lecture 4 1 Objectives Become familiar with basic statistics and the normal distribution. Learn how to compute the slope and intercept of a best-fit straight line with linear regression. Learn how to compute and understand the meaning of the how to compute and understand the meaning of the coefficient of determination and the standard error of the estimate. Learn how to use transformations to linearize nonlinear Learn how to use transformations to linearize nonlinear equations so that they can be fit with linear regression. EGR 102 Lecture 4 2 The Need to Account for The Need to Account for Variability in Engineering Material Properties Manufacturing Materials processing Materials processing, machining tolerances, weld and fastener locations Frequency Stiffness, strength, conductivity, density Loading Magnitude, direction, direction, distribution EGR 102 Value Lecture 4 3 Statistics Review Statistics Review Measures of Central Tendency Arithmetic mean: the sum of the individual data points (xi) divided by the number of points n: xi x= n Median: the midpoint of a group of data. Mode: the value that occurs most frequently in group of most frequently in a group of data. EGR 102 Lecture 4 4 Statistics Review Statistics Review Measures of Spread Standard deviation: St sy = n 1 where St is the sum of the squares of the data residuals: St = (yi y ) 2 and n -1 is referred to as the degrees of freedom. is referred to as the degrees of freedom Variance: (y y ) = y ( y ) / n = 2 s 2 y i 2 i 2 i n 1 Coefficient of variation: c.v. = s y 100% y EGR 102 n 1 Lecture 4 5 Histogram For large data sets, the histogram can be approximated by a smooth curve EGR 102 Lecture 4 6 Normal Distribution EGR 102 Lecture 4 7 Curve Fitting Method(s) to fit an equation to discrete data points Two general approaches: Data exhibit a significant degree of scatter Derive a single line (curve) that represents the general trend of the data Data is very precise Pass single curve through the points (interpolation) Pass a single curve through the points (interpolation) Three general applications in engineering: Trend analysis Predicting values between data points or beyond data range values between data points or beyond data range Hypothesis testing Comparing existing mathematical model with measured data Simplified modeling Developing simple math models to represent complex phenomenon EGR 102 Lecture 4 8 Curve Fitting (a) (b) (c) Data with significant error Polynomial fit oscillating beyond the range of the data fit oscillating beyond the range of the data Linear fit EGR 102 Lecture 4 9 Linear Least-Squares Regression Linear least-squares regression is a method to determine the best coefficients in a linear model for given data set. Best for least-squares regression means minimizing the sum of the squares of the estimate residuals. For a straight line model, this gives: n n Sr = e = (yi a0 a1 xi ) 2 2 i i =1 i =1 This method will yield a unique line for a given set of data. EGR 102 Lecture 4 10 Least-Squares Fit of a Straight Line Using the model: y = a0 + a1 x where: a0 = intercept & a1 = slope, the slope and intercept producing the best fit can the slope and intercept producing the best fit can be found using: a1 = n xi yi xi yi n x 2 i ( x ) 2 i a0 = y a1 x EGR 102 Lecture 4 11 Quantification of Error The residual represents the square of the vertical distance between a data point and the best-fit line: n n Sr = e = (yi a0 a1 xi ) 2 i i =1 EGR 102 Lecture 4 2 i =1 12 Example a1 = V (m/s) F (N) i xi yi (xi)2 xiyi 1 10 25 100 250 2 20 70 400 30 380 900 40 550 1600 50 610 2500 30500 6 60 1220 3600 73200 7 70 830 4900 58100 8 80 1450 6400 116000 360 5135 20400 = 19.47024 22000 5 8(312850 ) (360)(5135 ) 11400 4 ( x ) = 1400 3 n xi yi xi yi 312850 n x 2 i 2 i 8(20400 ) (360) 2 a0 = y a1 x = 641.875 19.47024 (45) = 234.2857 Fest = 234 .2857 + 19.47024 v 13 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 reduction in spread represents the improvement to due linear regression. Standard error of the estimate quantifies spread around the regression line: around the regression line: EGR 102 Lecture 4 sy / x = Sr n2 14 Coefficient of Determination The coefficient of determination r 2 is the difference between the sum of the squares of the data residuals and the sum of the squares of the estimate residuals, normalized by the sum of the squares of the data n residuals: id 2 St - Sr r= St 2 S t = ( yi y ) i =1 n n i =1 i =1 S r = ei2 = ( yi a0 a1 xi ) 2 r 2 represents the percentage of the original uncertainty explained by the model. For a perfect fit, Sr=0 and r 2=1. If r 2=0, there is no improvement over simply picking the mean. If If r 2<0, the model is worse than simply picking the mean! 0, the model is worse simply picking the mean! r is called the correlation coefficient EGR 102 Lecture 4 15 Coefficient of Determination An alternative formula more convenient for implementation on a computer: EGR 102 Lecture 4 16 Example V (m/s) i xi yi Fest = 234.2857 + 19.47024 v F (N) St = (yi y ) = 1808297 2 a0+a1xi (yi- )2 (yi-a0-a1xi)2 1 10 25 -39.58 380535 4171 Sr = (yi a0 a1 xi ) = 216118 2 20 70 155.12 327041 7245 3 30 380 349.82 68579 911 4 40 550 544.52 8441 5 50 610 739.23 1016 6 60 1220 933.93 334229 7 70 830 1128.63 35391 89180 8 80 1450 1323.33 653066 16044 360 5135 1808297 216118 2 sy = 1808297 = 508.26 8 1 216118 = 189.79 82 16699 1808297 216118 2 = 0.8805 81837 r = 1808297 30 sy / x = 88.05% of the original uncertainty has been explained by the linear model 17 Nonlinear Relationships Linear regression is predicated on the fact that the relationship between the dependent and independent variables is linear variables is linear - this is not always the case. is not always the case Three common examples are: exponential : y = 1e1 x power : y = 2 x 2 x saturation - growth - rate : y = 3 3 + x EGR 102 Lecture 4 18 Linearization of Nonlinear Relationships One option for finding the coefficients for a nonlinear fit is to linearize it. For the three common models, this may involve taking logarithms or inversion: taking logarithms or inversion: Model Nonlinear Linearized exponential : y = 1e1 x ln y = ln 1 + 1 x power : y = 2 x 2 log y = log 2 + 2 log x x saturation - growth - rate : y = 3 3 + x EGR 102 Lecture 4 1 1 3 1 =+ y 3 3 x 19 Transformation Examples EGR 102 Lecture 4 20 Least Squares Example Fit a straight line to the li data given below: xi yi 1 0.5 2 2.5 3 2.0 4 4.0 5 3.5 6 6.0 7 5.5 EGR 102 Lecture 4 21 Least Squares Example For the data: th n = 7 xi = 28 yi = 24 xi yi 1 0.5 24 28 y= = 3.428571 x= =4 2 2.5 7 7 3 2.0 2 xi yi = 119.5 xi = 140 4 4.0 5 3.5 6 6.0 7 5.5 EGR 102 Lecture 4 22 Least Squares Example Calculate the slope and intercept for the line: a1 = n xi yi xi yi n x ( xi ) 2 i 2 7(119.5) 28(24) = = 0.8392857 2 7(140) ( 28) a0 = y a1 x = 3.428571 0.8392857(4) = 0.07142857 So, the least-squares fit is: y = 0.07142857 + 0.8392857 x EGR 102 Lecture 4 23 Least Squares Example y = 0.07142857 + 0.8392857 x r= n xi yi ( xi )( yi ) n xi ( xi ) 2 n yi ( yi ) 2 2 2 = 0.932 r = 0.868 2 EGR 102 Lecture 4 24 Verification Method x y x*y x^2 1 0.5 0.5 1 2 2.5 5 4 3 2 6 9 4 4 16 16 5 3.5 17.5 25 6 6 36 36 7 5.5 38.5 49 7 836.5 980 n nSumxy nSum x^2 28 Sum x Sum y 4 3.428571 mean x mean y a1 0.839286 a0 EGR 102 24 672 0.071429 Lecture 4 Sumx*Sumy 25 Verification Method 7 To plot in Excel 6 Set x & y values, add titles, etc. Select a data point 5 4 y Chart Wizard XY Scatter y = 0.8393x + 0.0714 R2 = 0.8683 3 2 1 0 Right click Right click Add Trendline Linear Options Display equation on chart Options Display R-squared value on chart 0 EGR 102 Lecture 4 1 2 3 4 5 6 7 x 26 8 Lecture 04 Quiz Take out a blank piece of paper Print your name, lab section # and PID at top Using only your course text, notes you have taken & your hand calculator: Independently, solve the problem on the next slide When you are finished, place your quiz in the you you qu appropriate envelope at the back of the room & you may leave EGR 102 Lecture 4 27 Lecture 04 Quiz Use Gauss elimination to solve the equations below. Show all work to receive full credit. Express your answers to 1 decimal place. 2x1 + x2 3x3 = 11 11 4x1 2x2 + 3x3 = 8 -2x1 + 2x2 x3 = -6 EGR 102 Lecture 4 28
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Michigan State University - EGR - 102
EGR 102Introduction toEngineering ModelingCurve FittingPolynomial RegressionRegressionChapter 15.1-15.3Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw HillEGR 102Lecture 51A Few Words aboutFew Words aboutAcademic Di
Michigan State University - EGR - 102
EGR 102Introduction toEngineering ModelingStructured ProgrammingChapter 3.3-3.43.3Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw HillEGR 102Lecture 071Lab Exam 1Scores &amp; solutions posted on AngelGrading parity used
Michigan State University - EGR - 102
EGR 102Introduction toEngineering ModelingBracketing MethodsChapter 5.1-5.45.1Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw HillEGR 102Lecture 81ObjectivesUnderstand what roots problems are and wherethey occur in e
Michigan State University - EGR - 102
EGR 102Introduction toEngineering ModelingNewton-Raphson MethodChapter 6.1-6.26.1Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw HillEGR 102Lecture 91Objectives Know the difference between bracketing and openmethods
Michigan State University - EGR - 102
EGR 102Introduction toEngineering ModelingOptimization - Newtons MethodChapter 7.1-7.2Figures from: Applied Numerical Methods with MATLAB, Steven Chapra, McGraw HillEGR 102Lecture 101Objectives Understand why and where optimization occursin eng
Michigan State University - EGR - 102
EGR102Name:BlakeJunakSection:2Spring2012Lab01AHomeworkBoxDimensionsLength(m)0.200.250.300.350.400.50Width(m)0.200.250.300.350.400.50Height(m)4.003.503.002.502.001.50Volume(m^3)0.1600.2190.2700.3060.3200.375
Michigan State University - EGR - 102
EGR102Name:BlakeJunakSection:2Spring2012Lab01AHomeworkBoxDimensionsLength(m)0.200.250.300.350.400.50Width(m)0.200.250.300.350.400.50Height(m)4.003.503.002.502.001.50Volume(m^3)0.1600.2190.2700.3060.3200.375
Michigan State University - EGR - 102
Height vs. Distance1210He ight (ft .)8642002radians+1/2gradians+35 0.6108652381/2g4681012D is t ance (ft .)y=x5.000016257y=5.000004372tan50 0.503212109xdegrees26 . 7121 0.466213993tandegrees30 0.700207538Vo16.08716
Michigan State University - EGR - 102
Blake JunakSection 2Lab HW 04BPart 1:Gas Powered Pressure Washer:function [ Pascal ] = Pascal_Conversion( PSI )%LabHW04%This function converts pressure from PSI to Pascal.Pascal=PSI*4.448*39.37^2;End&gt; [Pascal]=Pascal_Conversion(PSI)Pascal =1.
Michigan State University - EGR - 102
&gt; run('/Users/bjunak5/Documents/School/EGR 102/LabHW08A.m')Final_Velocities =44.595162.249948.853942.161052.2570rows =25314columns =1011121314%Blake Junak%Section 2%This script is used to calculate the velocity of a parachutist for th
Michigan State University - EGR - 102
Blake JunakSection 2function[xr]=LabHW10A(xl,xu)%Blake Junak%Section 2%This function will determine the roots of a polynomal function%These are the original functionsf_xu=-1.2*(xu^2)+1.35*xu+5.9;f_xl=-1.2*(xl^2)+1.35*xl+5.9;%If functionif f_xl*f
Michigan State University - EGR - 102
Blake JunakSection 2function [D,Steel,Square,Steel_Square] = LABHW10B(p,l)%Blake Junak%Section 2%This function will use nested loops to calculate each element of anarray%and generate outputs with the same formatting and input values as for a%previ
Michigan State University - EGR - 102
Michigan State University - CEM - 161
Michigan State University - CEM - 161
Michigan State University - CEM - 161
Michigan State University - CEM - 161
Michigan State University - CEM - 161
Michigan State University - CEM - 161
Michigan State University - CEM - 161
Michigan State University - PHY - 183
Your Instructor Instructor: Richard HallsteinPhysics for Scientists &amp;Engineers 1 Office: Biomedical and Physical Sciences BuildingBPS 1253 hallstein@pa.msu.edu (preferred mode of contact) Phone: 517-884-5509PHY 183 Dont call me on the phone unles
Michigan State University - PHY - 183
GeometryA = area, V = volume, C = circumference (or perimeter)Physics for Scientists &amp;Engineers 1Spring Semester 2012Lecture 2 - Math PrimerJanuary 10, 2012Physics for Scientists&amp;Engineers 11January 10, 2012Physics for Scientists&amp;Engineers 1Fun
Michigan State University - PHY - 183
I&gt;Clicker RegistrationPhysics for Scientists &amp;Engineers 1Spring Semester 2012Lecture 3 Unit Conversion and VectorsJanuary 11, 2012Physics for Scientists&amp;Engineers 11Physics for Scientists&amp;Engineers 1Unit ConversionUnit conversionWhen two quanti
Michigan State University - PHY - 183
Vector Subtraction For every vector A there is a vector A, with thesame length, pointing in the exact oppositedirectionPhysics for Scientists &amp;Engineers 1A + ( A) = 0A A Vector subtraction:y To obtain the vector = B A ,Dwe add the vector A to
Michigan State University - PHY - 183
Clicker QuizPhysics for Scientists &amp;Engineers 1The train in this picture isA. Slowing downB. Speeding upC. Moving at a constantspeedD. Cant tellFall Semester 2011Lecture 5Position, Displacement, Speed, VelocityJanuary 17, 2012Physics for Scie
Michigan State University - PHY - 183
Acceleration Vector The average acceleration is defined as the velocity changeper time intervalvax = xtPhysics for Scientists &amp;Engineers 1 The instantaneous acceleration is given byax = lim ax = limt 0Spring Semester 2012Physics for Scientists
Michigan State University - PHY - 183
Exam 1 Exam 1 will take place in class Monday You need to bring 5 inch by 8 inch card of notes (you can use both sides) A calculator A #2 pencilPhysics for Scientists &amp;Engineers 1 Pick up an answer sheet at the front of theclassroom and sit in yo
Michigan State University - PHY - 183
Three Dimensional Coordinate Systems Now we move from one dimensional motion tomotion in two and three dimensions We will work in Cartesian coordinatesPhysics for Scientists &amp;Engineers 1Spring Semester 201Lecture 8Motion in Two and Three Dimension
Michigan State University - PHY - 183
Shoot the Monkey Scenario: A zookeeper needs to tranquilize a monkey that hasescaped. The monkey is hanging from a branch in a tree.The zookeeper aims directly at the monkey and pulls thetrigger on her dart gun. The sound of the dart gunstartles the
Michigan State University - PHY - 183
Hitting a Home Run Suppose a batter hits a baseball so that it has an initiallaunch angle of 35 and an initial speed of 110 mph(realistic) How far will the baseball go? We call the distance the ball travels the range R We have derived the range in t
Michigan State University - PHY - 183
Types of Forces Contact forcePhysics for Scientists &amp;Engineers 1 Spring force A force is needed to stretch orcompress a spring Has the special property that itdepends linearly on thechange in length of the springSpring Semester 2012Lecture 11F
Michigan State University - PHY - 183
Two Pulleys Ropes and pulleys can be combined to lift objectsthat are too heavy to lift otherwise Lets consider the case of two pulleys One pulley is tied to the ceiling and the other ismovable A mass m is hung from the movable pulley We pull down
Michigan State University - PHY - 183
Friction Introduction of a new force: friction Friction forces are present in practically all kinematicalprocesses Concerning friction we observe the followingPhysics for Scientists &amp;Engineers 1 If an object is at rest, then it takes a threshold of
Michigan State University - PHY - 183
What is Energy? Richard Feynman talks about the concept ofenergy: It is important to realize that in physics today,we have no knowledge of what energy is. We donot have a picture that energy comes in littleblobs of a definite amount. It is not that
Michigan State University - PHY - 183
Power for a Constant ForcePhysics for Scientists &amp;Engineers 1 Final answer: Or:Physics for Scientists&amp;Engineers 11February 8, 2012Accelerating CarW = K = K K 0 = 508 kJPhysics for Scientists&amp;Engineers 13February 8, 2012P = Fv = Fdrag v The f
Michigan State University - PHY - 183
Clicker Quiz A ball of mass m is thrown vertically into the air with aninitial speed v. Which of the following equations correctly describesthe maximum height, h, of the ball?A) h =Physics for Scientists &amp;Engineers 1K + U = K0 + U 0120 + mgh = mv
Michigan State University - PHY - 183
Linear Momentum Linear momentum is theproduct of mass (scalar) andvelocity (vector)Physics for Scientists &amp;Engineers 1p = mv Momentum vector andvelocity vector are parallelto each other Magnitude of the linearmomentumSpring Semester 2012Lectu
Michigan State University - PHY - 183
Physics for Scientists &amp;Engineers 1Spring Semester 2012Lecture 18Special Cases for Elastic 1d Collisions, 2D CollisionsFebruary 15, 2012Physics for Scientists&amp;Engineers 11ElasticElastic Scattering Yesterday we introduced the following for the el
Michigan State University - PHY - 183
Head-on Collision Consider a head-on collision of a full-size SUV, with massM = 3023 kg, and a compact car, with mass m = 1184 kgPhysics for Scientists &amp;Engineers 1 Each vehicle has an initial speed of 22.35 m/s and aremoving in opposite directions
Michigan State University - PHY - 183
Center of Mass and Center of Gravity In our previous discussions this semester we have alwaystreated the location of objects as a single point A car is located at x = 5.5 m Of course, the car is not ALL at x =5.5 m The natural choice for the location
Michigan State University - PHY - 183
Fire Hose What is the magnitude of the force that acts on a firefighter holding afire hose that ejects 360 L of water per minute with a muzzle speed of39.0 m/s?Physics for Scientists &amp;Engineers 1 SOLUTION The total mass of water that is being eject
Michigan State University - PHY - 183
Clicker Quiz Does a rocket require something topush on in order to move?A.YesB. NoPhysics for Scientists &amp;Engineers 1Spring Semester 2012Lecture 22Coordinate Systems andCalculation of Center of MassPhysics for Scientists&amp;Engineers 1February 23
Michigan State University - PHY - 183
Circular Motion Circular motion is motion along the perimeter of a circle Circular motion is surprisingly common CD, DVD, Blu-ray, Indy-car racing, carousel, ferris wheel, etc.Physics for Scientists &amp;Engineers 1Spring Semester 2012Lecture 23Circul
Michigan State University - PHY - 183
ClickerClicker Quiz A horizontal table rotates counterclockwise withconstant angular velocity. The components of thelinear acceleration are at (tangential) and ac(centripetal). Select the correct statement withrespect to the components of the accele
Michigan State University - PHY - 183
Example: Hammer Throw Throw the hammer, a 12 cm diameter ballattached to a grip by a steel cable, a maximumdistance The hammers total length is 121.5 cm, and itstotal weight is 7.26 kg (4 kg for women) The athlete has to accomplish the throw whilen
Michigan State University - PHY - 183
Rotation We have been treating bodies by looking at themotion of the center of mass We introduced the concept of motion of the centerof mass + rotation about the center of mass We have covered circular motion of the center ofmass Now we will study
Michigan State University - PHY - 183
Rolling without Slipping Lets assume that we have a round object withradius R rolling without slipping This object has special relationships between itslinear and angular quantitiesPhysics for Scientists &amp;Engineers 1 Displacement and angular displa
Michigan State University - PHY - 183
Torque So far in our discussion of forces, we have shownthat forces can cause linear motion of objects We described the motion of these objects in termsof the motion of the center of mass of the object However, we have not addressed one generalquest
Michigan State University - PHY - 183
Newtons Second Law for Rotation Newtons Second Law for Rotation: = IPhysics for Scientists &amp;Engineers 1 Yesterday we saw that taller trees will fall more slowly thanshorter trees. The angular acceleration is proportional to 1/L Consider how easy i
Michigan State University - PHY - 183
Equilibrium Conditions In chapter 4 we explored the conditions formechanical equilibrium We found that the necessary condition formechanical equilibrium is the absence of a netexternal force In that case Newtons First Law stipulates that anobject i
Michigan State University - PHY - 183
Stability For a skyscraper or a bridge,designers and builders need toworry about the ability of thethe structure to remainstanding under the influence ofexternal forces For example, consider thebridge carrying Interstate 35Wacross the Mississippi
Michigan State University - PHY - 183
New Exam Seating ChartLAST NAMEAjayi - BossBotros - CloonanCoats - FettingFinkbiner - HarrisHe - KasenowKeller - MakiMarti - MindroiuMoore - ParkPatel - RemingtonRichardson - SlaterSmith - TrombleyTruong - XhaferllariXin - ZilliSIT IN ROWO
Michigan State University - PHY - 183
Final ExamYesterdays Exam An Adobe print error caused some exams to printoutincorrectly. Your exam score on the correction exam will be used as yourexam 8 score. Our Common Comprehensive Final Exam is onThursday, May 3rd from 8:00-10:00PM Location
Michigan State University - PHY - 183
Final Exam Our Common Comprehensive Final Exam is on Thursday, May3rd from 8:00-10:00PM Location Chemistry (CEM) room 138Physics for Scientists &amp;Engineers 1 Two 8.5 inch by 11 inch sheets of notes (both sides) Calculator Alternate Final Exam Univ
Michigan State University - PHY - 183
Final Exam Our Common Comprehensive Final Exam is on Thursday, May3rd from 8:00-10:00PM Location Chemistry (CEM) room 138Physics for Scientists &amp;Engineers 1 Two 8.5 inch by 11 inch sheets of notes (both sides) Calculator Alternate Final Exam Univ
Michigan State University - PHY - 183
Michigan State University - PHY - 183
Michigan State University - PHY - 183
Michigan State University - PHY - 183
Michigan State University - PHY - 183
Michigan State University - PHY - 183