Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modeling a Linear Relationship Lecture 47 Secs. 13.1 – 13.3.1 Tue, Apr 25, 2006.

Similar presentations


Presentation on theme: "Modeling a Linear Relationship Lecture 47 Secs. 13.1 – 13.3.1 Tue, Apr 25, 2006."— Presentation transcript:

1 Modeling a Linear Relationship Lecture 47 Secs. 13.1 – 13.3.1 Tue, Apr 25, 2006

2 Bivariate Data Data is called bivariate if each observations consists of a pair of values (x, y). Data is called bivariate if each observations consists of a pair of values (x, y). x is the explanatory variable. x is the explanatory variable. y is the response variable. y is the response variable. x is also called the independent variable. x is also called the independent variable. y is also called the dependent variable. y is also called the dependent variable.

3 Scatterplots Scatterplot – A display in which each observation (x, y) is plotted as a point in the xy plane. Scatterplot – A display in which each observation (x, y) is plotted as a point in the xy plane.

4 Example Draw a scatterplot of the percent on-time arrivals vs. percent on-time departures for the 22 airports listed in Exercise 4.29, p. 252, and also in Exercise 13.5, p 822. Draw a scatterplot of the percent on-time arrivals vs. percent on-time departures for the 22 airports listed in Exercise 4.29, p. 252, and also in Exercise 13.5, p 822. OnTimeArrivals.xls. OnTimeArrivals.xls. OnTimeArrivals.xls Does there appear to be a relationship? Does there appear to be a relationship? How can we tell? How can we tell? How would we describe that relationship? How would we describe that relationship?

5 Linear Association Draw (or imagine) an oval around the data set. Draw (or imagine) an oval around the data set. If the oval is tilted, then there is some linear association. If the oval is tilted, then there is some linear association. If the oval is tilted upwards from left to right, then there is positive association. If the oval is tilted upwards from left to right, then there is positive association. If the oval is tilted downwards from left to right, then there is negative association. If the oval is tilted downwards from left to right, then there is negative association. If the oval is not tilted at all, then there is no association. If the oval is not tilted at all, then there is no association.

6 Positive Linear Association x y

7 x y

8 Negative Linear Association x y

9 x y

10 No Linear Association x y

11 x y

12 Strong vs. Weak Association The association is strong if the oval is narrow. The association is strong if the oval is narrow. The association is weak if the oval is wide. The association is weak if the oval is wide.

13 Strong Positive Linear Association x y

14 x y

15 Weak Positive Linear Association x y

16 x y

17 TI-83 - Scatterplots To set up a scatterplot, To set up a scatterplot, Enter the x values in L 1. Enter the x values in L 1. Enter the y values in L 2. Enter the y values in L 2. Press 2 nd STAT PLOT. Press 2 nd STAT PLOT. Select Plot1 and press ENTER. Select Plot1 and press ENTER.

18 TI-83 - Scatterplots The Stat Plot display appears. The Stat Plot display appears. Select On and press ENTER. Select On and press ENTER. Under Type, select the first icon (a small image of a scatterplot) and press ENTER. Under Type, select the first icon (a small image of a scatterplot) and press ENTER. For XList, enter L 1. For XList, enter L 1. For YList, enter L 2. For YList, enter L 2. For Mark, select the one you want and press ENTER. For Mark, select the one you want and press ENTER.

19 TI-83 - Scatterplots To draw the scatterplot, To draw the scatterplot, Press ZOOM. The Zoom menu appears. Press ZOOM. The Zoom menu appears. Select ZoomStat (#9) and press ENTER. The scatterplot appears. Select ZoomStat (#9) and press ENTER. The scatterplot appears. Press TRACE and use the arrow keys to inspect the individual points. Press TRACE and use the arrow keys to inspect the individual points.

20 Example Use the TI-83 to draw a scatterplot of the following data. Use the TI-83 to draw a scatterplot of the following data. xy 23 35 59 612 916

21 Simple Linear Regression To quantify the linear relationship between x and y, we wish to find the equation of the line that “best” fits the data. To quantify the linear relationship between x and y, we wish to find the equation of the line that “best” fits the data. Typically, there will be many lines that all look pretty good. Typically, there will be many lines that all look pretty good. How do we measure how well a line fits the data? How do we measure how well a line fits the data?

22 Measuring the Goodness of Fit Start with the scatterplot. Start with the scatterplot. x y

23 Measuring the Goodness of Fit Draw any line through the scatterplot. Draw any line through the scatterplot. x y

24 Measuring the Goodness of Fit Measure the vertical distances from every point to the line Measure the vertical distances from every point to the line x y

25 Measuring the Goodness of Fit Each of these represents a deviation, called a residual e, from the line. Each of these represents a deviation, called a residual e, from the line. x y e

26 Residuals The i th residual – The difference between the observed value of y i and the predicted value of y i. The i th residual – The difference between the observed value of y i and the predicted value of y i. Use y i ^ for the predicted y i. Use y i ^ for the predicted y i. The formula for the i th residual is The formula for the i th residual is Notice that the residual is positive if the data point is above the line and it is negative if the data point is below the line. Notice that the residual is positive if the data point is above the line and it is negative if the data point is below the line.

27 Measuring the Goodness of Fit Each of these represents a deviation, called a residual e, from the line. Each of these represents a deviation, called a residual e, from the line. x y e xixi yi^yi^ yiyi

28 Measuring the Goodness of Fit Find the sum of the squared residuals. Find the sum of the squared residuals. x y e xixi yi^yi^ yiyi

29 Measuring the Goodness of Fit The smaller the sum of squared residuals, the better the fit. The smaller the sum of squared residuals, the better the fit. x y e xixi yi^yi^ yiyi

30 Example Consider the data points Consider the data points xy 23 35 59 612 916

31 Example 2 3456789 5 10 15

32 Least Squares Line Let’s see how good the fit is for the line Let’s see how good the fit is for the line y ^ = -1 + 2x, where y ^ represents the predicted value of y, not the observed value.

33 Sum of Squared Residuals Begin with the data set. Begin with the data set. xy 23 35 59 612 916

34 Sum of Squared Residuals Compute the predicted y, using y ^ = -1 + 2x. Compute the predicted y, using y ^ = -1 + 2x. xyy^y^ 233 355 599 61211 91617

35 Sum of Squared Residuals Compute the residuals, y – y ^. Compute the residuals, y – y ^. xyy^y^ y – y ^ 2330 3550 5990 612111 91617

36 Sum of Squared Residuals Compute the squared residuals. Compute the squared residuals. xyy^y^ y – y ^ (y – y ^ ) 2 23300 35500 59900 6121111 916171

37 Sum of Squared Residuals Compute the sum of the squared residuals. Compute the sum of the squared residuals. xyy^y^ y – y ^ (y – y ^ ) 2 23300 35500 59900 6121111 916171  (y – y ^ ) 2 = 2.00

38 Sum of Squared Residuals Now let’s see how good the fit is for the line Now let’s see how good the fit is for the line y ^ = -0.5 + 1.9x.

39 Sum of Squared Residuals Begin with the data set. Begin with the data set. xy 23 35 59 612 916

40 Sum of Squared Residuals Compute the predicted y, using y ^ = -0.5 + 1.9x. Compute the predicted y, using y ^ = -0.5 + 1.9x. xyy^y^ 233.3 355.2 599.0 61210.9 91616.6

41 Sum of Squared Residuals Compute the residuals, y – y ^. Compute the residuals, y – y ^. xyy^y^ y – y ^ 233.3-0.3 355.2-0.2 599.00.0 61210.91.1 91616.6-0.6

42 Sum of Squared Residuals Compute the squared residuals. Compute the squared residuals. xyy^y^ y – y ^ (y – y ^ ) 2 233.3-0.30.09 355.2-0.20.04 599.00.00.00 61210.91.11.21 91616.6-0.60.36

43 Sum of Squared Residuals Compute the sum of the squared residuals. Compute the sum of the squared residuals. xyy^y^ y – y ^ (y – y ^ ) 2 233.3-0.30.09 355.2-0.20.04 599.00.00.00 61210.91.11.21 91616.6-0.60.36  (y – y ^ ) 2 = 1.70

44 Sum of Squared Residuals We conclude that y ^ = -0.5 + 1.9x is a better fit than y ^ = -1 + 2x. We conclude that y ^ = -0.5 + 1.9x is a better fit than y ^ = -1 + 2x.

45 Sum of Squared Residuals 2 3456789 5 10 15 y ^ = -1 + 2x

46 Sum of Squared Residuals 2 3456789 5 10 15 y ^ = -0.5 + 1.9x

47 Least Squares Line Least squares line – The line for which the sum of the squares of the distances is as small as possible. Least squares line – The line for which the sum of the squares of the distances is as small as possible. The least squares line is also called the line of best fit or the regression line. The least squares line is also called the line of best fit or the regression line.

48 Example For all the lines that one could draw through this data set, For all the lines that one could draw through this data set, it turns out that 1.70 is the smallest possible value for the sum of the squares of the residuals. xy 23 35 59 612 916

49 Example Therefore, Therefore, y ^ = -0.5 + 1.9x is the regression line for this data set.

50 Regression Line We will write regression line as We will write regression line as a is the y-intercept. a is the y-intercept. b is the slope. b is the slope. This is the usual slope-intercept form y = mx + b with the two terms rearranged and relabeled. This is the usual slope-intercept form y = mx + b with the two terms rearranged and relabeled.

51 TI-83 – Computing Residuals It is not hard to compute the residuals and the sum of their squares on the TI-83. It is not hard to compute the residuals and the sum of their squares on the TI-83. (Later, we will see a faster method.) (Later, we will see a faster method.) Enter the x-values in list L 1 and the y-values in list L 2. Enter the x-values in list L 1 and the y-values in list L 2. Compute a + b*L 1 and store in list L 3 (y ^ values). Compute a + b*L 1 and store in list L 3 (y ^ values). Compute (L 2 – L 3 ) 2. This is a list of the squared residuals. Compute (L 2 – L 3 ) 2. This is a list of the squared residuals. Compute sum(Ans). This is the sum of the squared residuals. Compute sum(Ans). This is the sum of the squared residuals.

52 TI-83 – Computing Residuals Enter the data set Enter the data set and use the equation y ^ = -0.5 + 1.9x to compute the sum of squared residuals. xy 23 35 59 612 916

53 Prediction Use the regression line to predict y when Use the regression line to predict y when x = 4 x = 4 x = 7 x = 7 x = 20 x = 20 Interpolation – Using an x value within the observed extremes of x values to predict y. Interpolation – Using an x value within the observed extremes of x values to predict y. Extrapolation – Using an x value beyond the observed extremes of x values to predict y. Extrapolation – Using an x value beyond the observed extremes of x values to predict y.

54 Interpolation vs. Extrapolation Interpolated values are more reliable then extrapolated values. Interpolated values are more reliable then extrapolated values. The farther out the values are extrapolated, the less reliable they are. The farther out the values are extrapolated, the less reliable they are.


Download ppt "Modeling a Linear Relationship Lecture 47 Secs. 13.1 – 13.3.1 Tue, Apr 25, 2006."

Similar presentations


Ads by Google