1 / 48

Understanding Correlation and Regression in Data Analysis

Learn how to determine the linear relationship between variables, using regression lines to predict values and interpret slopes and intercepts. Calculate regression equations and explore properties of regression lines.

tjoan
Download Presentation

Understanding Correlation and Regression in Data Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 7 Linear Regression Day 1 – (pg 176-184)

  2. Correlation and Regression • Correlation = linear relationship between two variables. • Summarize relationship with line. • Called Regression line. • Explanatory variable (x) • Response variable (y)

  3. Regression line • Explains how response variable (y) changes in relation to explanatory variable (x). • Use line to predict value of y for given value of x. • The predicted values are called • Values on the regression line. • The observed values are called y. • Points in the scatterplot.

  4. Regression line • Residual - the difference between the observed value and its associated predicted value. • To find the residuals, we always subtract the predicted value from the observed one:

  5. Least squares regression (LSRL) • Most commonly used regression line. • Puts line where sum of the squared errors (residuals) as small as possible. • Minimizes • Based on statistics

  6. Regression line equation where

  7. Regression line equation • b1 = slope of line. • For every unit increase in x, changes by the amount of the slope. • Very important for interpreting data. • b0 = y-intercept of line. • The value of when x = 0. • Usually not important for interpreting data. • Values of x are usually not close to 0.

  8. Calculating the regression line. • Degree Days vs. Gas Usage

  9. Calculating the regression line. • Degree Days vs. Gas Usage

  10. Calculating the regression line. • Degree Days vs. Gas Usage

  11. Calculating the regression line. • Degree Days vs. Gas Usage

  12. Calculating the regression line. • Don’t forget to write the equation. • Where = predicted gas usage • x = degree days • ALWAYS IDENTIFY THE VARIABLES

  13. Interpretations • Slope • For every one unit increase in degree days, the predicted gas usage increases by 0.19 • Intercept • When the degree days is 0, the predicted gas usage is 1.07

  14. Prediction • Use regression equation to predict y from x. • Ex. Predicted gas consumption when degree days = 40? • Ex. Predicted gas consumption when degree days = 20?

  15. Prediction • Use regression equation to predict y from x. • Ex. Predicted gas consumption when degree days = 40? • Ex. Predicted gas consumption when degree days = 20?

  16. Prediction • Use regression equation to predict y from x. • Ex. Predicted gas consumption when degree days = 40? • Ex. Predicted gas consumption when degree days = 20?

  17. Plotting the regression line • Find two points on line. • Pick two x values • Find predicted for each x value. • Ex. x = 20, =4.87 and x = 40, = 8.67 • Plot two points on graph. • Make line through two points. • Regression line .

  18. Finding In Calculator • Stat  Edit  Enter Data in L1 and L2 • Stat  Calc  8: LinReg (y = a + bx) • x 16 24 42 60 75 102 120 • y 24 30 35 40 48 56 60 • LSRL:

  19. Example: A random sample of records of sales of homes from Feb. 15 to Apr. 30, 1993, from the files maintained by the Albuquerque Board of Realtors gives the price (in thousands of dollars) and size (in square feet) of 117 homes. A regression analysis gives us the model: • What does the slope of this line say about housing prices and house size? • What price would you predict to pay for a 3000 square foot home? • A real estate agent shows a potential buyer a 1200 sq-ft home with an asking price that is $6000 less than one would expect to pay for a house of that size. What is the asking price?

  20. Example • Every square foot increase in size increases the average price $0.061x1000, or $61. • $230,820 (230.82 thousand) • $115,020

  21. Homework – Read Chapter 7 Pg 184 – 196 Ch 7 Day 1 WS

  22. Properties of regression line • Regression line always goes through point • r is connected to the value of b1. • r has same sign as b1. (If slope is negative, correlation is negative & vice versa)

  23. Properties of regression line • The values of the y variable vary. • Regression line tries to explain variation of y through its relationship with x. • Not perfectly – points not exactly on line. • Points close to line = regression explains variation of y well. • Points far from line = regression does not explain variation of y well.

  24. Properties of regression line • How much variation can we explain with our regression? • Answer:R2 • Percent of variation in y that is explained by the linear relationship with x. • Higher values of R2 mean regression line helps explain the variation in y variable.

  25. Degree Days vs. Gas Usage • R2 = r2 • Ex. r = 0.9953, R2 = 0.9906 or 99.06% of the variation in gas usage can be explained by the linear relationship with number of degree days.

  26. Example: Roller Coasters People who responded to a July 2004 Discovery Channel poll names the 10 best roller coasters in the United States. A table in Chapter 7, Exercise 33 shows the length of the initial drop (in feet) and the duration of the ride (in seconds). A regression to predict duration from drop has R2=12.4%. • What are the variables and units in this regression? • Write a sentence (in context) summarizing that the R2 says about this regression. • What is the correlation between drop and duration?

  27. Example: Roller Coasters a. y: Duration (in seconds) x: drop (in feet) b. Differences in height explain 12.4% of the variability in the duration of the ride… (or better)… “12.4% of the variation in y (the duration of the ride) can be explained by the least squares regression with x (length of the initial drop).” c. 0.352

  28. Residuals • Variation in y not measured by regression line. • Formula: • Residual for each data point. • Mean of residuals = 0.

  29. Example: Calculating Residuals • Degree Days vs. Gas Usage • Find the residual for the point (30,6.4)

  30. Calculating Residuals • Degree Days vs. Gas Usage • Find the residual for the point (30,6.4)

  31. Calculating Residuals • Degree Days vs. Gas Usage • Find the residual for the point (30,6.4)

  32. Calculating Residuals • Find the residual for the point (13,4.0)

  33. Calculating Residuals • Find the residual for the point (13,4.0)

  34. Calculating Residuals • Find the residual for the point (13,4.0)

  35. Residual Plots • Scatterplot • Explanatory variable (x) on horizontal axis. • Residuals (e) on vertical axis. • Horizontal line at residual = 0. • Good Residual Plot • No pattern or shape • No outliers

  36. Interpreting Residual Plots • The residual plot should show about the same amount of scatter throughout!! If it has a… • Curved Pattern • relationship is not linear. • Increasing spread about line as x increases. • Predictions of y for larger x will be less accurate. • Decreasing spread about line as x increases. • Predictions of y for smaller x will be less accurate.

  37. Example: Children’s Ages and Heights The ages (in months) and heights (in inches) of seven children are given. x 16 24 42 60 75 102 120 y 24 30 35 40 48 56 60 Find the LSRL. Interpret the slope and correlation coefficient in the context of the problem.

  38. Correlation coefficient: There is a strong, positive, linear association between the age and height of children. Slope: For an increase in age of one month, there is an approximateincrease of .34 inches in heights of children.

  39. The ages (in months) and heights (in inches) of seven children are given. x 16 24 42 60 75 102 120 y 24 30 35 40 48 56 60 Predict the height of a child who is 4.5 years old. Predict the height of someone who is 20 years old.

  40. Create the residual plot of the data in your calculator: Stat  Edit  Enter Data in L1 and L2 Stat  Calc  8: LinReg (y = a + bx) 2nd y= (stat plot)  Plot 1 Type: Scatterplot Xlist = L1 Ylist = 2nd  Stat (List)  7: Residuals Enter Zoom  9 Is a LSRL appropriate here? Why?

  41. The LSRL should not be used to predict y for values of x outside the data set. It is unknown whether the pattern observed in the scatterplot continues outside this range. Extrapolation

  42. Reading Computer Output Exercise physiologists are investigating the relationship between lean body mass (in kilograms) and the resting metabolic rate (in calories per day) in sedentary males. What is the LSRL?

  43. The correlation coefficient and the LSRL are both non-resistant measures.

  44. You should be able to…. • Calculate a regression line given summary statistics. • Interpret the slope and intercept of the regression line. • Find predictions and residuals for points. • Interpret a residual plot. • Interpret the R2 value for a regression. • Understand the limitations of regression.

More Related