Download presentation
Presentation is loading. Please wait.
1
Regression and Residual Plots
Section 3.2
2
Amount of soda remaining (mL)
Tapping on Cans Amount of soda remaining (mL) 0 sec 4sec 8 sec 12 sec 245 260 267 275 255 250 271 280 268 270 276 285 265 290 248 284 278 251 261 279 249 259
3
The number of seconds spent tapping is the explanatory variable and the amount left in the can is the response. Store the data in L1 and L2.
4
Itโs easier to copy the scatterplot to paper if you adjust the window to numbers which make sense for the data. Be sure to label the axes.
5
Create the least-squares regression line.
๐ฆ = ๐ฅ predicts the number of milliliters of soda left after โxโ seconds of tapping.
6
Interpreting the regression equation
๐ฆ is the predicted value of the response variable y for a given value of the explanatory variable x. The slope is the amount by which y is predicted to change when x increases by one unit. (2.635 more mL of soda for each additional second of tapping.) The y-intercept is the predicted value of y when x = 0. ( mL of soda is the predicted amount if the can is not tapped at all.) We wonโt always be able to see the y-intercept on our scatterplots because of how we label the y-axis.
7
Return to the Graph screen to see the regression line superimposed on the data. Use โtraceโ to examine y-values and ๐ฆ values. Note that the difference between an actual y-value and the vertical distance to the regression line is called a residual.
8
Residuals are stored in a list called โresidualsโ on the TI-84
Residuals are stored in a list called โresidualsโ on the TI-84. Store these values in L3. The sum of the residuals is zero. The regression line is the line that makes the sum of the squared residuals as small as possible. Notice that residuals have both size and direction.
9
We can examine the sum of the squared residuals using L4 and the sum command on the TI-84.
is the smallest sum of the squared residuals from any line which can be drawn through the data points. This means that the errors in predicting y are minimized.
10
Properties of the least-squares regression line.
๐ฆ will always run through the means of the x data and the y data. I.e., ( ๐ฅ , ๐ฆ ) is always a solution of ๐ฆ =๐+๐๐ฅ. An outlier will always โpullโ the regression line towards itself. The closer the outlier is to ( ๐ฅ , ๐ฆ ), the less it will change the slope of the regression line. Outliers in the extreme x-direction are more likely to be influential than those in the y-direction. ml
11
HOW TO CALCULATE THE LEAST-SQUARES REGRESSION LINE using only the means, standard deviations, and correlation. We have data on an explanatory variable x and a response variable y for n individuals. From the data, calculate the means and the standard deviations sx and sy of the two variables and their correlation r. The least-squares regression line is the line = a + bx with: Slope and y intercept This means that a change in x of 1 standard deviation is met with an โrโ standard deviation change in y. So, y is closer to ๐ฆ than x is to ๐ฅ . We say that โthe values of y regress to their mean.โ
12
For the can tapping example with r = 0.924
1-Variable Stats for x 1-Variable Stats for y ๐๐๐๐๐ ๐ = โ =2.635 and ๐ฆโ๐๐๐ก๐๐๐๐๐๐ก ๐ =264.45โ โ6=248.64
13
Determining the appropriateness of a linear model using a โresidual plotโ
Because the sum of the residuals (measured from the least-squared regression line) is always zero, the mean of these residuals is also zero. A residual plot consists of the scatterplot of the residuals and the horizontal line y = 0. The horizontal line represents the regression line. (The regression line is a distance of 0 from itself.) Plot the explanatory variable values (in L1) as x, and the residuals (in L3) as y.
14
Use Plot 2 and L1 and L3 to draw the residual plot.
15
Linearity is indicated by random scatter.
If you see any sort of leftover pattern or curve in the scatter plot, then a linear model is not appropriate. Think of this: form of the residual plot = form of association โ form of model Remember this by remembering that residual = observed y โ predicted y.
16
How well does the regression line โfitโ the data
How well does the regression line โfitโ the data? Standard deviation of residuals & Coefficient of determination. Standard deviation of the residuals This tells us the approximate size of the โtypicalโ prediction error (residual). When we use the least-squares regression line to predict the amount of soda left in a can given the number of seconds it was tapped,ย our predictions will typically be off by about 4.9 mL.
17
Predicting amount of soda if you donโt know the tapping time (x) โ use ๐ฆ
Prediction error using ๐ฆ Prediction error using ๐ฆ =14.6% of the variation in the soda remaining is unaccounted for by the regression line. So, (100 โ 14.6)% = 85.4% is accounted for by the regression line.
18
Coefficient of determination (r2)
The 85.4% we found on the last slide is called the coefficient of determination. It is the square of the correlation, r. DEFINITION:ย The coefficient of determination: r2 Theย coefficient of determinationย r2ย is the fraction of the variation in the values ofย y that is accounted for by the least-squares regression line ofย yย onย x.ย We can calculateย r2 using the following formula: Prediction error using regression line, ๐ฆ Prediction error using mean, ๐ฆ
19
Interpreting computer output โ How does seat in a classroom affect test scores?
Predictor Coef SE Coef T P Constant Row S = R-Sq = 4.7% R-Sq(adj) = 1.3%
20
(a) What is the equation of the least-squares regression line that describes the relationship between row number and test score? Define any variables that you use. (b) Interpret the slope of the regression line in context. (c) Find the correlation. (When you take the square root of the coefficient of determination, be sure to choose the sign correctly.) (d) Is a line an appropriate model to use for these data? Explain how you know.
21
More practice interpreting computer output.
23
Should we use a linear model and, if so, how accurate will our predictions be?
Use the four step process: State Plan Do Conclude STATE:ย Is a linear model appropriate for these data?ย If so,ย how well does the least-squares regression line fit the data? PLAN:ย To determine whether a linear model is appropriate,ย we will look at the scatterplot and residual plot to see if the association is linear or nonlinear.ย Then,ย if a linear model is appropriate,ย we will use the standard deviation of the residuals andย r2 to measure how well the least-squares line fits the data.
24
DO:ย The scatterplot shows a moderately strong,ย negative linear association between age at first word and Gesell score.ย There are a couple of outliers in the scatterplot. Child 19 has a very high Gesell score for his or her age at first word.ย Also,ย child 18 didnโt speak his or her first word until much later than the other children in the study and has a much lower Gesell score.ย The residual plot does not have any obvious patterns,ย confirming what we saw in the scatterplotโ a linear model is appropriate for these data.
25
From the computer output, the equation of the least-squares regression line is = โ x. The standard deviation of the residuals is s = This means that our predictions will typically be off by points when we use the linear model to predict Gesell scores from age at first word.ย Finally,ย 41% of the variation in Gesell score is accounted for by the linear model relating Gesell score to age at first word.
26
CONCLUDE: Although a linear model is appropriate for these data, our predictions might not be very accurate. Our typical prediction error is about 11 points, and more than half of the variation in Gesell score is still unaccounted for. Furthermore, we should be hesitant to use this model to make predictions until we understand the effect of the two outliers on the regression results.
27
DEFINITION: Outliers and influential observations in regression
Anย outlierย is an observation that lies outside the overall pattern of the other observations.ย Points that are outliers in theย yย direction but not theย xย direction of a scatterplot have large residuals.ย Other outliers may not have large residuals. An observation isย influentialย for a statistical calculation if removing it would markedly change the result of the calculation.ย Points that are outliers in theย xย direction of a scatterplot are often influential for the least-squares regression line. (the best way to determine if an outlier is influential is to calculate the regression line with and without the point.)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.