Chapter 8 Part 2 Linear Regression

Slides:



Advertisements
Similar presentations
Chapter 8 Linear Regression
Advertisements

Linear Regression.  The following is a scatterplot of total fat versus protein for 30 items on the Burger King menu:  The model won’t be perfect, regardless.
Chapter 8 Linear regression
Chapter 8 Linear regression
Linear Regression Copyright © 2010, 2007, 2004 Pearson Education, Inc.
Copyright © 2010 Pearson Education, Inc. Chapter 8 Linear Regression.
Residuals Revisited.   The linear model we are using assumes that the relationship between the two variables is a perfect straight line.  The residuals.
Chapter 8 Linear Regression.
Extrapolation: Reaching Beyond the Data
Copyright © 2009 Pearson Education, Inc. Chapter 8 Linear Regression.
Chapter 8 Linear Regression © 2010 Pearson Education 1.
Statistics Residuals and Regression. Warm-up In northern cities roads are salted to keep ice from freezing on the roadways between 0 and -9.5 ° C. Suppose.
CHAPTER 8: LINEAR REGRESSION
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 8 Linear Regression.
Chapter 7 Linear Regression.
Chapter 8: Linear Regression
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 8 Linear Regression.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 8 Linear Regression.
Chapter 8 Linear Regression. Slide 8- 2 Fat Versus Protein: An Example The following is a scatterplot of total fat versus protein for 30 items on the.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 8 Linear Regression (3)
Chapter 8 Linear Regression
Chapter 8 Linear Regression HOW CAN A MODEL BE CREATED WHICH REPRESENTS THE LINEAR RELATIONSHIP BETWEEN TWO QUANTITATIVE VARIABLES?
Chapter 8 Linear Regression. Objectives & Learning Goals Understand Linear Regression (linear modeling): Create and interpret a linear regression model.
CHAPTER 8 Linear Regression. Residuals Slide  The model won’t be perfect, regardless of the line we draw.  Some points will be above the line.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 8- 1.
Linear Regression Chapter 8. Fat Versus Protein: An Example The following is a scatterplot of total fat versus protein for 30 items on the Burger King.
Copyright © 2010 Pearson Education, Inc. Chapter 8 Linear Regression.
Copyright © 2009 Pearson Education, Inc. Chapter 8 Linear Regression.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 7, Slide 1 Chapter 7 Linear Regression.
Statistics 8 Linear Regression. Fat Versus Protein: An Example The following is a scatterplot of total fat versus protein for 30 items on the Burger King.
Honors Statistics Chapter 8 Linear Regression. Objectives: Linear model Predicted value Residuals Least squares Regression to the mean Regression line.
Part II Exploring Relationships Between Variables.
AP Statistics Chapter 8 Linear Regression. Objectives: Linear model Predicted value Residuals Least squares Regression to the mean Regression line Line.
Training Activity 4 (part 2)
CHAPTER 3 Describing Relationships
Chapter 3: Describing Relationships
Unit 4 Lesson 4 (5.4) Summarizing Bivariate Data
Chapter 5 Lesson 5.3 Summarizing Bivariate Data
Chapter 8 Linear Regression.
Chapter 7 Linear Regression.
Chapter 8 Linear Regression Copyright © 2010 Pearson Education, Inc.
Regression and Residual Plots
CHAPTER 3 Describing Relationships
CHAPTER 3 Describing Relationships
Least-Squares Regression
Chapter 3: Describing Relationships
Chapter 8 Part 1 Linear Regression
Chapter 3: Describing Relationships
Chi-square Test for Goodness of Fit (GOF)
Chapter 3: Describing Relationships
Least-Squares Regression
CHAPTER 3 Describing Relationships
CHAPTER 3 Describing Relationships
CHAPTER 3 Describing Relationships
Warmup A study was done comparing the number of registered automatic weapons (in thousands) along with the murder rate (in murders per 100,000) for 8.
CHAPTER 3 Describing Relationships
Chapter 3: Describing Relationships
Chapter 3: Describing Relationships
CHAPTER 3 Describing Relationships
CHAPTER 3 Describing Relationships
Chapter 3: Describing Relationships
Chapter 3: Describing Relationships
CHAPTER 3 Describing Relationships
Algebra Review The equation of a straight line y = mx + b
Chapter 3: Describing Relationships
Chapter 3: Describing Relationships
Chapter 3: Describing Relationships
Honors Statistics Review Chapters 7 & 8
Review of Chapter 3 Examining Relationships
CHAPTER 3 Describing Relationships
Presentation transcript:

Chapter 8 Part 2 Linear Regression Honors Statistics Chapter 8 Part 2 Linear Regression

Objectives: Linear model Predicted value Residuals Least squares Regression to the mean Regression line Line of best fit Slope intercept se R2

R2—The Variation Accounted For The variation in the residuals is the key to assessing how well the model fits. Compare the variation of the response variable with the variation of the residuals. In the BK menu items example, total fat has a standard deviation of 16.4 grams. The standard deviation of the residuals is 9.2 grams.

R2—The Variation Accounted For If the correlation were 1.0 and the model predicted the fat values perfectly, the residuals would all be zero and have no variation. As it is, the correlation is 0.83—not perfection. However, we do see that the model residuals had less variation than total fat alone. We can determine how much of the variation is accounted for by the model and how much is left in the residuals.

R2—The Variation Accounted For The squared correlation, r2, gives the fraction of the data’s variance accounted for by the model. Thus, 1 – r2 is the fraction of the original variance left in the residuals. For the BK model, r2 = 0.832 = 0.69, so 31% of the variability in total fat has been left in the residuals.

R2—The Variation Accounted For All regression analyses include this statistic, although by tradition, it is written R2 (pronounced “R-squared”). An R2 of 0 means that none of the variance in the data is in the model; all of it is still in the residuals. When interpreting a regression model you need to Tell what R2 means. In the BK example, according to the model 69% of the variation in total fat is accounted for by variation in the protein content.

R2—The Variation Accounted For The R2 is the Coefficient of Determination, indicates how well the model (the LSRL) fits the data. R2 values are between 0 and 1. The closer R2 is to 1, the better the regression line explains the response. R2 gives the fraction of the variability of y that is explained by the least squares linear regression on x. Example: R2=.73 means 73% of the total variation in y is explained by the linear model.

How Big Should R2 Be? R2 is always between 0% and 100%. What makes a “good” R2 value depends on the kind of data you are analyzing and on what you want to do with it. The standard deviation of the residuals can give us more information about the usefulness of the regression by telling us how much scatter there is around the line.

Reporting R2 Along with the slope and intercept for a regression, you should always report R2 so that readers can judge for themselves how successful the regression is at fitting the data. Statistics is about variation, and R2 measures the success of the regression model in terms of the fraction of the variation of y accounted for by the regression.

More on Outliers Outlying points can strongly influence regression. A point can be an outlier because its x-value is extraordinary, because its y-value is extraordinary, or because it deviates from the overall pattern of the data. A point has leverage and is call an influential point if its removal causes the slope of the regression line to change dramatically.

More on Outliers Although the indicated point lies outside the overall pattern of the data set, its removal has little effect on the regression line. It would not be considered an influential point.

More on Outliers The point in the lower right-hand corner of the graph is an outlier in the x-direction. Its removal causes the slope of the regression line to change dramatically. This point has leverage and is an influential point.

Influential Point - Summary As seen in the prior examples, points that are outliers in the x-direction on a scatterplot are often influential on the calculation of the LSRL or linear model.

Regression: Assumptions and Conditions Quantitative Variables Condition: Regression can only be done on two quantitative variables (and not two categorical variables), so make sure to check this condition. Straight Enough Condition: The linear model assumes that the relationship between the variables is linear. A scatterplot will let you check that the assumption is reasonable.

Regression: Assumptions and Conditions If the scatterplot is not straight enough, stop here. You can’t use a linear model for any two variables, even if they are related. They must have a linear association or the model won’t mean a thing. Some nonlinear relationships can be saved by re-expressing the data to make the scatterplot more linear.

Regression: Assumptions and Conditions It’s a good idea to check linearity again after computing the regression when we can examine the residuals. Does the Plot Thicken? Condition: Look at the residual plot -- for the standard deviation of the residuals to summarize the scatter, the residuals should share the same spread. Check for changing spread in the residual scatterplot.

Regression: Assumptions and Conditions Outlier Condition: Watch out for outliers. Outlying points can dramatically change a regression model. Outliers can even change the sign of the slope, misleading us about the underlying relationship between the variables. If the data seem to clump or cluster in the scatterplot, that could be a sign of trouble worth looking into further.

Reality Check: Is the Regression Reasonable? Statistics don’t come out of nowhere. They are based on data. The results of a statistical analysis should reinforce your common sense, not fly in its face. If the results are surprising, then either you’ve learned something new about the world or your analysis is wrong. When you perform a regression, think about the coefficients and ask yourself whether they make sense.

What Can Go Wrong? Don’t fit a straight line to a nonlinear relationship. Beware extraordinary points (y-values that stand off from the linear pattern or extreme x-values). Don’t extrapolate beyond the data—the linear model may no longer hold outside of the range of the data. Don’t infer that x causes y just because there is a good linear model for their relationship—association is not causation. Don’t choose a model based on R2 alone.

What have we learned? When the relationship between two quantitative variables is fairly straight, a linear model can help summarize that relationship. The regression line doesn’t pass through all the points, but it is the best compromise in the sense that it has the smallest sum of squared residuals.

What have we learned? The correlation tells us several things about the regression: The slope of the line is based on the correlation, adjusted for the units of x and y. For each SD in x that we are away from the x mean, we expect to be r SDs in y away from the y mean. Since r is always between –1 and +1, each predicted y is fewer SDs away from its mean than the corresponding x was (regression to the mean). R2 gives us the fraction of the response accounted for by the regression model.

What have we learned? The residuals also reveal how well the model works. If a plot of the residuals against predicted values shows a pattern, we should re-examine the data to see why. The standard deviation of the residuals quantifies the amount of scatter around the line.

What have we learned? The linear model makes no sense unless the Linear Relationship Assumption is satisfied. Also, we need to check the Straight Enough Condition and Outlier Condition with a scatterplot. For the standard deviation of the residuals, we must make the Equal Variance Assumption. We check it by looking at both the original scatterplot and the residual plot for Does the Plot Thicken? Condition.

Put it Altogether Example Review

Example: Creating and Using a Least Squares Regression Line A student wanted to see how good she was at predicting distances measured in meters. She randomly selected 7 distances to estimate. After recording her estimated distances, she used a range finder to find the actual distances. Next is a scatterplot of the Actual Distances vs. Estimated Distances and the corresponding residual plot.

Make a Picture

Check Conditions for Regression Quantitative Variables Condition: Actual Distance and Estimated Distance are quantitative. Straight Enough Condition: The data follow a straight line pattern. Outlier Condition: There are no outliers in the data. Does the Plot Thicken? Condition: The residual plot shows no obvious patterns. The scatterplot follows a linear pattern with no apparent outliers. The residual plot shows no discernable pattern, so a linear model is appropriate.

Numerical Analysis Use your calculator to find the equation of the LSRL, if given the data; however, you need to be able to read various computer outputs to be successful on the AP Statistics exam. There will be things on the printout that you might not be familiar with, such as the F-ratio. Focus on finding the information you need to write the equation of the LSRL (ie. Slope & y-intercept).

Typical Questions on the Regression State the equation of the LSRL. Define any variables used.

Question Interpret the slope and the y-intercept of the LSRL.

Question State and interpret the correlation coefficient.

Question State and interpret the coefficient of determination.

Question Predict the actual distance from an object when the estimated distance is 4 meters.

Question For an estimated distance of 4 meters, the actual distance from the object was 4.2 meters. What is the residual for this data value?