Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modeling a Linear Relationship

Similar presentations


Presentation on theme: "Modeling a Linear Relationship"— Presentation transcript:

1 Modeling a Linear Relationship
Lecture 47 Secs – Tue, Dec 6, 2005

2 Bivariate Data Data is called bivariate if each observations consists of a pair of values (x, y). x is the explanatory variable. y is the response variable. x is also called the independent 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.

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. OnTimeArrivals.xls. Does there appear to be a relationship? How can we tell? How would we describe that relationship?

5 Linear Association Draw an oval around the data set.
If the set of points forms a tilted oval, 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 downwards from left to right, then there is negative association. If the oval is not tilted at all, then there is no association.

6 Positive Linear Association
y x

7 Positive Linear Association
y x

8 Negative Linear Association
y x

9 Negative Linear Association
y x

10 No Linear Association y x

11 No Linear Association y x

12 Practice Draw a scatterplot of the data in Example 13.2, p. 816.
How should we label the x-axis? How should we label the y-axis?

13 Example Is there a linear association? Is it positive or negative?

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

15 Strong Positive Linear Association
y x

16 Strong Positive Linear Association
y x

17 Weak Positive Linear Association
y x

18 Weak Positive Linear Association
y x

19 Example In Example 13.2, In Exercise 13.5,
Is there the linear association strong or is it weak? In Exercise 13.5, How should we describe the association?

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

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

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

23 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. Typically, there will be many lines that all look pretty good. How do we measure how well a line fits the data?

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

25 Measuring the Goodness of Fit
Draw a line through the scatterplot. y x

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

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

28 Residuals The i th residual – The difference between the observed value of yi and the predicted value of yi. Use yi^ for the predicted yi. The formula for the ith 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.

29 Measuring the Goodness of Fit
Find the sum of the squared residuals. y e x

30 Measuring the Goodness of Fit
The smaller the sum of squared residuals, the better the fit. y e x

31 Example Consider the data points x y 2 3 5 9 6 12 16

32 Example 15 10 5 2 3 4 5 6 7 8 9

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

34 Sum of Squared Residuals
Begin with the data set. x y 2 3 5 9 6 12 16

35 Sum of Squared Residuals
Compute the predicted y, using y^ = x. x y y^ 2 3 5 9 6 12 11 16 17

36 Sum of Squared Residuals
Compute the residuals, y – y^. x y y^ y – y^ 2 3 5 9 6 12 11 1 16 17 -1

37 Sum of Squared Residuals
Compute the squared residuals. x y y^ y – y^ (y – y^)2 2 3 5 9 6 12 11 1 16 17 -1

38 Sum of Squared Residuals
Compute the sum of the squared residuals. x y y^ y – y^ (y – y^)2 2 3 5 9 6 12 11 1 16 17 -1 (y – y^)2 = 2.00

39 Sum of Squared Residuals
Now let’s see how good the fit is for the line y^ = x.

40 Sum of Squared Residuals
Begin with the data set. x y 2 3 5 9 6 12 16

41 Sum of Squared Residuals
Compute the predicted y, using y^ = x. x y y^ 2 3 3.3 5 5.2 9 9.0 6 12 10.9 16 16.6

42 Sum of Squared Residuals
Compute the residuals, y – y^. x y y^ y – y^ 2 3 3.3 -0.3 5 5.2 -0.2 9 9.0 0.0 6 12 10.9 1.1 16 16.6 -0.6

43 Sum of Squared Residuals
Compute the squared residuals. x y y^ y – y^ (y – y^)2 2 3 3.3 -0.3 0.09 5 5.2 -0.2 0.04 9 9.0 0.0 0.00 6 12 10.9 1.1 1.21 16 16.6 -0.6 0.36

44 Sum of Squared Residuals
Compute the sum of the squared residuals. x y y^ y – y^ (y – y^)2 2 3 3.3 -0.3 0.09 5 5.2 -0.2 0.04 9 9.0 0.0 0.00 6 12 10.9 1.1 1.21 16 16.6 -0.6 0.36 (y – y^)2 = 1.70

45 Sum of Squared Residuals
We conclude that y^ = x is a better fit than y^ = x.

46 Sum of Squared Residuals
y^ = x 15 10 5 2 3 4 5 6 7 8 9

47 Sum of Squared Residuals
y^ = x 15 10 5 2 3 4 5 6 7 8 9

48 Least Squares Line 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 regression line or the line of best fit.

49 Example 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. x y 2 3 5 9 6 12 16

50 Example Therefore, y^ = x is the regression line for this data set.

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

52 TI-83 – Computing Residuals
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. Enter the x-values in list L1 and the y-values in list L2. Compute a + b*L1 and store in list L3 (y^ values). Compute (L2 – L3)2. This is a list of the squared residuals. Compute sum(Ans). This is the sum of the squared residuals.

53 TI-83 – Computing Residuals
Enter the data set and use the equation y^ = x to compute the sum of squared residuals. x y 2 3 5 9 6 12 16

54 Prediction Use the regression line to predict y when
x = 4 x = 7 x = 20 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.

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


Download ppt "Modeling a Linear Relationship"

Similar presentations


Ads by Google