Linear Least Squares Approximation By Kristen Bauer, Renee Metzger, Holly Soper, Amanda Unklesbay.

Slides:



Advertisements
Similar presentations
Graph Linear Systems Written in Standard Form
Advertisements

Managerial Economics in a Global Economy
Let Maths take you Further…
Statistical Techniques I EXST7005 Simple Linear Regression.
Quadratic Functions and Equations
Integrals 5.
Regression Greg C Elvers.
Quantitative Methods 2 Lecture 3 The Simple Linear Regression Model Edmund Malesky, Ph.D., UCSD.
1 Simple Linear Regression and Correlation The Model Estimating the Coefficients EXAMPLE 1: USED CAR SALES Assessing the model –T-tests –R-square.
P M V Subbarao Professor Mechanical Engineering Department
Lecture 3 Cameron Kaplan
A second order ordinary differential equation has the general form
Ch 5.2: Series Solutions Near an Ordinary Point, Part I
GG 313 Geological Data Analysis # 18 On Kilo Moana at sea October 25, 2005 Orthogonal Regression: Major axis and RMA Regression.
Ch 3.4: Repeated Roots; Reduction of Order
ESTIMATING THE REGRESSION COEFFICIENTS FOR SIMPLE LINEAR REGRESSION.
Ch 3.5: Repeated Roots; Reduction of Order
Solving Absolute Value Equations
ax² + bx + c = 0 x² + 8x + 16 = f(x) To make the chart, you simply take any number and plug it in for x in the equation and the value you get is the y.
Quadratic Functions A quadratic function is a function with a formula given by the standard form f(x) = ax2+bx+c, where a, b, c, are constants and Some.
16 Days. Two Days  Review - Use FOIL and the Distributive Property to multiply polynomials.
Copyright © Cengage Learning. All rights reserved.
Solving Quadratic Equations Section 1.3
Copyright © Cengage Learning. All rights reserved.
Logarithmic and Exponential Functions
Physics 114: Lecture 15 Probability Tests & Linear Fitting Dale E. Gary NJIT Physics Department.
Chapter 8 Review Quadratic Functions.
1.3 Solving Equations Using a Graphing Utility; Solving Linear and Quadratic Equations.
Hosted by: Hosted by: Mr. Kautza Mr. Kautza Jeopardy $100 $200 $300 $400 $500 $100 $200 $ $300 $400 $500*$500 Final Jeopardy Square Roots Graphing.
Unit 4: Modeling Topic 6: Least Squares Method April 1, 2003.
02 – Object Modeling Overview Point Selection Bounding Box Line Equation Least Square Line Equation Conclusions.
CHAPTER 5 EXPRESSIONS AND FUNCTIONS GRAPHING FACTORING SOLVING BY: –GRAPHING –FACTORING –SQUARE ROOTS –COMPLETING THE SQUARE –QUADRATIC FORMULA.
Linear Regression James H. Steiger. Regression – The General Setup You have a set of data on two variables, X and Y, represented in a scatter plot. You.
5.6 Quadratic Equations and Complex Numbers
Copyright © Cengage Learning. All rights reserved. 4 Quadratic Functions.
Functions of Several Variables Copyright © Cengage Learning. All rights reserved.
Linear Regression Least Squares Method: an introduction.
SOLVING QUADRATIC EQUATIONS Unit 7. SQUARE ROOT PROPERTY IF THE QUADRATIC EQUATION DOES NOT HAVE A “X” TERM (THE B VALUE IS 0), THEN YOU SOLVE THE EQUATIONS.
GG 313 Geological Data Analysis Lecture 13 Solution of Simultaneous Equations October 4, 2005.
Linear Least-Squares Approximation Ellen and Jason.
Chapter 6 (cont.) Difference Estimation. Recall the Regression Estimation Procedure 2.
By: Adam Linnabery. The quadratic formula is –b+or-√b 2 -4ac 2a an example of how it is used: X 2 -4x-12=0 the coefficient of x 2 is 1 therefore the value.
3.1 INTRODUCTION TO THE FAMILY OF QUADRATIC FUNCTIONS Functions Modeling Change: A Preparation for Calculus, 4th Edition, 2011, Connally.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 3 Association: Contingency, Correlation, and Regression Section 3.3 Predicting the Outcome.
Slide Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Quadratic Functions.
Getting Started The objective is to be able to solve any quadratic equation by using the quadratic formula. Quadratic Equation - An equation in x that.
1 Simple Linear Regression and Correlation Least Squares Method The Model Estimating the Coefficients EXAMPLE 1: USED CAR SALES.
Remember: Slope is also expressed as rise/run. Slope Intercept Form Use this form when you know the slope and the y- intercept (where the line crosses.
Functions of Several Variables Copyright © Cengage Learning. All rights reserved.
Lecture 8: Ordinary Least Squares Estimation BUEC 333 Summer 2009 Simon Woodcock.
Chapter 2 Copyright © 2015, 2011, 2007 Pearson Education, Inc. Chapter 2-1 Solving Linear Equations and Inequalities.
CHAPTER 5 EXPRESSIONS AND FUNCTIONS GRAPHING FACTORING SOLVING BY: –GRAPHING –FACTORING –SQUARE ROOTS –COMPLETING THE SQUARE –QUADRATIC FORMULA.
Chapter 9 Quadratic Functions and Equations. U-shaped graph such as the one at the right is called a parabola. ·A parabola can open upward or downward.
Statistics 350 Lecture 2. Today Last Day: Section Today: Section 1.6 Homework #1: Chapter 1 Problems (page 33-38): 2, 5, 6, 7, 22, 26, 33, 34,
Chapter 4 Quadratic Equations
Graphing Quadratic Functions Solving by: Factoring
Practice. Practice Practice Practice Practice r = X = 20 X2 = 120 Y = 19 Y2 = 123 XY = 72 N = 4 (4) 72.
Solving quadratics methods
Linear Regression Bonus
Multiple Regression.
1.4 Solving Equations Using a Graphing Utility
Linear regression Fitting a straight line to observations.
1.4 Solving Equations Using a Graphing Utility
Discrete Least Squares Approximation
Point-slope Form of Equations of Straight Lines
Differentiation Summary
Mathematical Sciences
5.4 Finding Linear Equations
Presentation transcript:

Linear Least Squares Approximation By Kristen Bauer, Renee Metzger, Holly Soper, Amanda Unklesbay

Linear Least Squares Is the line of best fit for a group of points It seeks to minimize the sum of all data points of the square differences between the function value and data value. It is the earliest form of linear regression

Gauss and Legendre The method of least squares was first published by Legendre in 1805 and by Gauss in Although Legendre’s work was published earlier, Gauss claims he had the method since Both mathematicians applied the method to determine the orbits of bodies about the sun. Gauss went on to publish further development of the method in 1821.

Example Consider the points (1,2.1), (2,2.9), (5,6.1), and (7,8.3) with the best fit line f(x) = 0.9x The squared errors are: x 1 =1f(1)=2.3y 1 =2.1 e 1 = (2.3 – 2.1)² =.04 x 2 =2f(2)=3.2y 2 =2.9 e 2 = (3.2 – 2.9)² =. 09 x 3 =5f(5)=5.9y 3 =6.1 e 3 = (5.9 – 6.1)² =.04 x 4 =7f(7)=7.7y 4 =8.3 e 4 = (7.7 – 8.3)² =.36 So the total squared error is =.53 By finding better coefficients of the best fit line, we can make this error smaller…

We want to minimize the vertical distance between the point and the line. E = (d 1 )² + (d 2 )² + (d 3 )² +…+(d n )² for n data points E = [f(x 1 ) – y 1 ]² + [f(x 2 ) – y 2 ]² + … + [f(x n ) – y n ]² E = [mx 1 + b – y 1 ]² + [mx 2 + b – y 2 ]² +…+ [mx n + b – y n ]² E= ∑( mx i + b – y i )²

E must be MINIMIZED! How do we do this? E = ∑(mx i + b – y i )² Treat x and y as constants, since we are trying to find m and b. So…PARTIALS!  E/  m = 0 and  E/  b = 0 But how do we know if this will yield maximums, minimums, or saddle points?

Minimum Point Maximum Point Saddle Point

Minimum! Since the expression E is a sum of squares and is therefore positive (i.e. it looks like an upward paraboloid), we know the solution must be a minimum. We can prove this by using the 2 nd Partials Derivative Test.

2 nd Partials Test And form the discriminant D = AC – B 2 1) If D < 0, then (x 0,y 0 ) is a saddle point. 2) If D > 0, then f takes on A local minimum at (x 0,y 0 ) if A > 0 A local maximum at (x 0,y 0 ) if A < 0 Suppose the gradient of f(x 0,y 0 ) = 0. (An instance of this is  E/  m =  E/  b = 0.) We set

Calculating the Discriminant

1) If D < 0, then (x 0,y 0 ) is a saddle point. 2) If D > 0, then f takes on A local minimum at (x 0,y 0 ) if A > 0 A local maximum at (x 0,y 0 ) if A < 0 Now D > 0 by an inductive proof showing that Those details are not covered in this presentation. We know A > 0 since A = 2 ∑ x 2 is always positive (when not all x’s have the same value).

Therefore… Setting E/m and E/b equal to zero will yield two minimizing equations of E, the sum of the squares of the error. Thus, the linear least squares algorithm (as presented) is valid and we can continue.

E = ∑(mx i + b – y i )² is minimized (as just shown) when the partial derivatives with respect to each of the variables is zero. ie:  E/  m = 0 and  E/  b = 0  E/  b = ∑2(mx i + b – y i ) = 0set equal to 0 m∑x i + ∑b = ∑y i mSx + bn = Sy  E/  m = ∑2x i (mx i + b – y i ) = 2∑(mx i ² + bx i – x i y i ) = 0 m∑x i ² + b∑x i = ∑x i y i mSxx + bSx = Sxy NOTE: ∑x i = Sx∑y i = Sy∑x i ² = Sxx∑x i y i = SxSy

Next we will solve the system of equations for unknowns m and b: nmSxx + bnSx = nSxy Multiply by n mSxSx + bnSx = SySx Multiply by Sx nmSxx – mSxSx = nSxy – SySx Subtract m(nSxx – SxSx) = nSxy – SySx Factor m Solving for m…

Next we will solve the system of equations for unknowns m and b: mSxSxx + bSxSx = SxSxy Multiply by Sx mSxSxx + bnSxx = SySxx Multiply by Sxx bSxSx – bnSxx = SxySx – SySxx Subtract b(SxSx – nSxx) = SxySx – SySxx Solve for b Solving for b…

Example: Find the linear least squares approximation to the data: (1,1), (2,4), (3,8) Sx = 1+2+3= 6 Sxx = 1²+2²+3² = 14 Sy = = 13 Sxy = 1(1)+2(4)+3(8) = 33 n = number of points = 3 The line of best fit is y = 3.5x – Use these formulas:

Line of best fit: y = 3.5x – 2.667

THE ALGORITHM in Mathematica

Activity For this activity we are going to use the linear least squares approximation in a real life situation. You are going to be given a box score from either a baseball or softball game. With the box score you are given you are going to write out the points (with the x coordinate being the number of hits that player had in the game and the y coordinate being the number of at-bats that player had in the game). After doing that you are going to use the linear least squares approximation to find the best fitting line. The slope of the besting fitting line you find will be the team’s batting average for that game.

In Conclusion… E = ∑(mx i + b – y i )² is the sum of the squared error between the set of data points {(x 1,y 1 ),…,(x i,y i ),…,(x n,y n )} and the line approximating the data f(x) = mx + b. By minimizing the error by calculus methods, we get equations for m and b that yield the least squared error:

Advantages Many common methods of approximating data seek to minimize the measure of difference between the approximating function and given data points. Advantages for using the squares of differences at each point rather than just the difference, absolute value of difference, or other measures of error include: –Positive differences do not cancel negative differences –Differentiation is not difficult –Small differences become smaller and large differences become larger

Disadvantages Algorithm will fail if data points fall in a vertical line. Linear Least Squares will not be the best fit for data that is not linear.

The End