1 / 62

Linear Regression ( LSRL)

Linear Regression ( LSRL). x – variable: is the independent or explanatory variable y - variable: is the dependent or response variable Use x to predict y. Bivariate data. b – is the slope it is the amount by which y increases when x increases by 1 unit a – is the y -intercept

lelia
Télécharger la présentation

Linear Regression ( LSRL)

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. Linear Regression(LSRL)

  2. x – variable: is the independent or explanatory variable y- variable: is the dependent or response variable Use x to predict y Bivariate data

  3. b – is the slope it is the amount by which y increases when x increases by 1 unit a – is the y-intercept it is the height of the line when x = 0 in some situations, the y-intercept has no meaning - (y-hat) means the predictedy Be sure to put the hat on the y

  4. The line that gives the best fit to the data set The line that minimizes the sum of the squares of the deviations from the line Least Squares Regression LineLSRL

  5. (3,10) y =.5(6) + 4 = 7 2 – 7 = -5 4.5 y =.5(0) + 4 = 4 0 – 4 = -4 -5 y =.5(3) + 4 = 5.5 10 – 5.5 = 4.5 -4 (6,2) (0,0) (0,0) Sum of the squares = 61.25

  6. (3,10) 6 Find y - y -3 (6,2) -3 (0,0) What is the sum of the deviations from the line? Will it always be zero? Use a calculator to find the line of best fit The line that minimizes the sum of the squares of the deviations from the line is the LSRL. Sum of the squares = 54

  7. Interpretations Slope: For each unit increase in x, there is an approximateincrease/decrease of b in y. Correlation coefficient: There is a direction, strength, type of association between x and y.

  8. 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.

  9. 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.

  10. 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.

  11. 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

  12. 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 Calculate x & y. Plot the point (x, y) on the LSRL. Will this point always be on the LSRL?

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

  14. Formulas – on chart

  15. The following statistics are found for the variables posted speed limit and the average number of accidents. Find the LSRL & predict the number of accidents for a posted speed limit of 50 mph.

  16. Correlation (r)

  17. Suppose we found the age and weight of a sample of 10 adults. Create a scatterplot of the data below. Is there any relationship between the age and weight of these adults?

  18. Suppose we found the height and weight of a sample of 10 adults. Create a scatterplot of the data below. Is there any relationship between the height and weight of these adults? Is it positive or negative? Weak or strong?

  19. The closer the points in a scatterplot are to a straight line - the stronger the relationship. The farther away from a straight line – the weaker the relationship

  20. Identify as having a positive association, a negative association, or no association. + • Heights of mothers & heights of their adult daughters - • Age of a car in years and its current value + • Weight of a person and calories consumed • Height of a person and the person’s birth month NO • Number of hours spent in safety training and the number of accidents that occur -

  21. Correlation Coefficient (r)- • A quantitative assessment of the strength & direction of the linear relationship between bivariate, quantitative data • Pearson’s sample correlation is used most • parameter – r(rho) • statistic - r

  22. Calculate r. Interpret r in context. There is a strong, positive, linear relationship between speed limit and average number of accidents per week.

  23. Strong correlation No Correlation Moderate Correlation Weak correlation Properties of r(correlation coefficient) • legitimate values of r are [-1,1]

  24. value of r does not depend on the unit of measurement for either variable x (in mm) 12 15 21 32 26 19 24 y 4 7 10 14 9 8 12 Find r. Change to cm & find r. The correlations are the same.

  25. value of r does not depend on which of the two variables is labeled x x 12 15 21 32 26 19 24 y 4 7 10 14 9 8 12 Switch x & y & find r. The correlations are the same.

  26. value of r is non-resistant • x 12 15 21 32 26 19 24 • y 4 7 10 14 9 8 22 • Find r. Outliers affect the correlation coefficient

  27. value of r is a measure of the extent to which x & y are linearly related A value of r close to zero does not rule out any strong relationship between x and y. r = 0, but has a definite relationship!

  28. Minister data: (Data on Elmo) r = .9999 So does an increase in ministers cause an increase in consumption of rum?

  29. Correlation does not imply causation Correlation does not imply causation Correlation does not imply causation

  30. Residuals, Residual Plots, & Influential points

  31. Residuals (error) - • The vertical deviation between the observations & the LSRL • the sum of the residuals is always zero • error = observed - expected

  32. Residual plot • A scatterplot of the (x, residual) pairs. • Residuals can be graphed against other statistics besides x • Purpose is to tell if a linear association exist between the x & y variables • If no pattern exists between the points in the residual plot, then the association is linear.

  33. Linear Not linear

  34. Residuals x Age Range of Motion 35 154 24 142 40 137 31 133 28 122 25 126 26 135 16 135 14 108 20 120 21 127 30 122 One measure of the success of knee surgery is post-surgical range of motion for the knee joint following a knee dislocation. Is there a linear relationship between age & range of motion? Sketch a residual plot. Since there is no pattern in the residual plot, there is a linear relationship between age and range of motion

  35. Residuals Age Range of Motion 35 154 24 142 40 137 31 133 28 122 25 126 26 135 16 135 14 108 20 120 21 127 30 122 Plot the residuals against the y-hats. How does this residual plot compare to the previous one?

  36. Residuals Residuals x Residual plots are the same no matter if plotted against x or y-hat.

  37. Coefficient of determination- • r2 • gives the proportion of variation in y that can be attributed to an approximate linear relationship between x & y • remains the same no matter which variable is labeled x

  38. SSEy = 1564.917 Age Range of Motion 35 154 24 142 40 137 31 133 28 122 25 126 26 135 16 135 14 108 20 120 21 127 30 122 Let’s examine r2. Suppose you were going to predict a future y but you didn’tknow the x-value. Your best guess would be the overall mean of the existing y’s. Now, find the sum of the squared residuals (errors). L3 = (L2-130.0833)^2. Do 1VARSTAT on L3 to find the sum. Sum of the squared residuals (errors) using the mean of y.

  39. SSEy = 1085.735 Age Range of Motion 35 154 24 142 40 137 31 133 28 122 25 126 26 135 16 135 14 108 20 120 21 127 30 122 Now suppose you were going to predict a future y but you DO know the x-value. Your best guess would be the point on the LSRL for that x-value (y-hat). Find the LSRL & store in Y1. In L3 = Y1(L1) to calculate the predicted y for each x-value. Now, find the sum of the squared residuals (errors). In L4 = (L2-L3)^2. Do 1VARSTAT on L4 to find the sum. Sum of the squared residuals (errors) using the LSRL.

  40. SSEy = 1564.917 SSEy = 1085.735 Age Range of Motion 35 154 24 142 40 137 31 133 28 122 25 126 26 135 16 135 14 108 20 120 21 127 30 122 By what percent did the sum of the squared error go down when you went from just an “overall mean” model to the “regression on x” model? This is r2 – the amount of the variation in the y-values that is explained by the x-values.

  41. Age Range of Motion 35 154 24 142 40 137 31 133 28 122 25 126 26 135 16 135 14 108 20 120 21 127 30 122 How well does age predict the range of motion after knee surgery? Approximately 30.6% of the variation in range of motion after knee surgery can be explained by the linear regression of age and range of motion.

  42. Interpretation of r2 Approximately r2% of the variation in y can be explained by the LSRL of x & y.

  43. Computer-generated regression analysis of knee surgery data: Predictor Coef Stdev T P Constant 107.58 11.12 9.67 0.000 Age 0.8710 0.4146 2.10 0.062 s = 10.42 R-sq = 30.6% R-sq(adj) = 23.7% Be sure to convert r2 to decimal beforetaking the square root! NEVER use adjusted r2! What is the equation of the LSRL? Find the slope & y-intercept. What are the correlation coefficient and the coefficient of determination?

  44. In a regression setting, an outlier is a data point with a large residual Outlier –

  45. Influential point- • A point that influences where the LSRL is located • If removed, it will significantly change the slope of the LSRL

  46. Racket Resonance Acceleration (Hz) (m/sec/sec) 1 105 36.0 2 106 35.0 3 110 34.5 4 111 36.8 5 112 37.0 6 113 34.0 7 113 34.2 8 114 33.8 9 114 35.0 10 119 35.0 11 120 33.6 12 121 34.2 13 126 36.2 14 189 30.0 One factor in the development of tennis elbow is the impact-induced vibration of the racket and arm at ball contact. Sketch a scatterplot of these data. Calculate the LSRL & correlation coefficient. Does there appear to be an influential point? If so, remove it and then calculate the new LSRL & correlation coefficient.

  47. Which of these measures are resistant? • LSRL • Correlation coefficient • Coefficient of determination NONE – all are affected by outliers

  48. Regression

  49. Weight Height What would you expect for other heights? How much would an adult female weigh if she were 5 feet tall? This distribution is normally distributed. (we hope) She could weigh varying amounts – in other words, there is a distribution of weights for adult females who are 5 feet tall. What about the standard deviations of all these normal distributions? We want the standard deviations of all these normal distributions to be the same. Where would you expect the TRUE LSRL to be?

  50. Regression Model • The mean responsemy has a straight-line relationship with x: • Where: slope β and intercept α are unknown parameters • For any fixed value of x, the responsey varies according to a normal distribution. Repeated responses of y are independent of each other. • The standard deviation of y (sy) is the same for all values of x. (sy is also an unknown parameter)

More Related