Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ch. 10 – Linear Regression (Day 2)

Similar presentations


Presentation on theme: "Ch. 10 – Linear Regression (Day 2)"— Presentation transcript:

1 Ch. 10 – Linear Regression (Day 2)

2 Things to check before you calculate a regression line…
Are the two variables quantitative? Like correlation, regression only works for quantitative variables Does the scatterplot indicate a straight line relationship? It doesn’t make sense to create a linear model if the data isn’t linear Are there any outliers? An outlier can throw off the line significantly

3 Drawing the line on the scatterplot

4 Residuals (again) Calculating residuals does more than just tell us how far off a single prediction is After we fit a regression model, plotting the residuals for all of the data points helps us to assess how well our model works If the model is a good fit for the data, we should see nothing interesting in the residual plot The residuals are usually plotted against x, but are sometimes plotted against ŷ (the predicted values of y), and occasionally against other variables

5 Plotting the Residuals
Find the residuals for our fertilizer problem Fertilizer Bushels Predicted Bushels Residuals 31 43 33 44 40 45 50 54 59 53 68 80 63 –0.0225 0.1465 46.762 –1.762 50.917 3.083 –1.6565 58.396 0.604 63.382 –0.382

6 Plotting the Residuals
Now plot the residuals against x Residuals Fertilizer(lbs) 30 80 3 -2 30 -2 4 80

7 On Your Calculator Every time you use your calculator to fit a regression model, it automatically stores a list titled “RESID” containing all of the residuals for that regression You can use this list as the “YList” in your STAT PLOT menu to draw a scatterplot of the residuals against the x values (or anything else)

8 What the Graph Tells Us This residual plot shows no particular patterns – that’s a good thing! It means that this model appears to be the best we can fit to the data Residuals Fert-ilizer 30 80 3 -2

9 When Residuals Send a Message
If a the residual plot has this pattern, it means that our predictions are less accurate for larger values of x or for larger values of ŷ (or over time, depending on what the residuals are plotted against)

10 When Residuals Send a Message
If a residual plot is curved, it tells us that our data was not as linear as we thought, and perhaps a nonlinear model should be used Residual plots can also accentuate outliers

11 The Accuracy of the Model
We should also look at the size of the residuals – they should be small relative to the size of the values of the response variable Measuring the standard deviation of the residuals (se) gives us a good idea of how closely our predictions match reality Residuals Fert-ilizer 30 80 3 -2

12 Another example… Draw a scatterplot x y 3 9.4 4 14.9 5 23.2 6 37.2 7
50.1 8 62.9 12

13 Find the equation of the least squares regression line and draw it on your scatterplot
Plot the residuals and comment on the fit of the linear model Since there is a clear pattern, a linear model is not a good fit for this set of data

14 R2 – The Variation Accounted for by the Model
Linear regression is closely connected to correlation Remember that the correlation coefficient (r) tells us how strong an association is between two variables It makes sense that the stronger the linear association, the better a linear model will describe that association In fact, r2 (sometimes shown as R2) tells us something very specific about the usefulness of our model

15 R2 – The Variation Accounted for by the Model
R2 tells us the proportion of the variation in our response variable that is explained by the association it has with the x-variable For the fertilizer problem, r2 = .9568 95.68% of the variation in the number of bushels produced is explained by this model This reminds us that other factors contribute to bushels produced (sun, rain, etc.)

16 Homework Pg. 551 # 28, 30 Draw a scatterplot
Find the Least squares regression line and draw it on your scatterplot Graph a residual plot Interpret R ^2


Download ppt "Ch. 10 – Linear Regression (Day 2)"

Similar presentations


Ads by Google