110 likes | 248 Vues
Linear Regression. A process to find the equation of a line that bests fits a set of 2-variable data. A Reasonable Estimate Median Median Line. Split the points into 3 equal parts Find the x-median and y median of each part to find median-median points
E N D
Linear Regression A process to find the equation of a line that bests fits a set of 2-variable data.
A Reasonable EstimateMedian Median Line Split the points into 3 equal parts Find the x-median and y median of each part to find median-median points Draw the line of best fit for the 3 median–median points
Residuals: • R1= Y1-[a(x1)+b] • Where a and b define the line of best fit and (x1,y1) is a point p1 • This is simply the vertical distance between point p1 and the line p1 Line of best fit R1
The Least Squares Line • The line that best fits the data is the line that minimizes the square of the residuals. • (Why do you think we square them?) The Least Squares Formula Y=ax+b b = y - ax (I made a sheet to lead you through the proof of this, ask if you want it. It is not a requirement)
Finding the Least Squares Line • Use Fathom • Use a Graphing Calculator • Use a spread Sheet Once you have the least squares line, you can use it to interpolate (estimate values between data points) and extrapolate (estimate values outside of the data set).
Using Fathom • 1) Create a table of x and y data • 2) Drag attributes (x and y) onto the horizontal and vertical axis respectively to create a scatter plot. • 3) goto Graph in the menu and select Least Squares Line
Using the TI 83 • Press STAT. • Choose 1 (EDIT). • Enter X values in L1 and Y values in L2. • To see a plot press stat plot and turn on plot 1. • Press STAT cursor over to CALC and press 4-LinReg(ax+b), hit ENTER • This gives you a and b values, you can use them to plot a line and see how it compares to your data points by pressing y= and using a and b to complete y=ax+b.
Using Excel 2003 • Enter Data in 2 columns and highlight • Goto Insert, select CHART, select x-y scatter • Press NEXT,NEXT and FINISH • Select a data point with a left click, right click on it and select ADD TRENDLINE • Press the options tab and select ‘display equation on chart’
Now that you have it • You can use the least squares line to predict what y value would likely go with an x value between given data points. This is called interpolating. • You can also predict what y value may go with an x value beyond the data set. This is called extrapolating. • You can also re-arrange the equation to find what x value goes with a given y value.
Outliers • Consider a Least Squares Line made in fathom, watch how it changes when 1 outlier is moved. • Outliers can affect (reduce) the accuracy of a least squares line and are sometimes removed.
Practice • Page 180 1,2,5,6,7