Presentation is loading. Please wait.

Presentation is loading. Please wait.

Calculating the Least Squares Regression Line

Similar presentations


Presentation on theme: "Calculating the Least Squares Regression Line"— Presentation transcript:

1 Calculating the Least Squares Regression Line
Lecture 45 Sec Wed, Apr 25, 2007

2 The Least Squares Regression Line
The equation of the regression line is y^ = a + bx. Thus, we need to find the coefficients a and b. The formulas are or

3 Example Consider again the data set x y 2 3 5 9 6 12 16

4 Method 1 Compute the means and deviations for x and y. x y x –x y –y
2 3 -3 -6 5 -2 -4 9 6 12 1 16 4 7 x = 5 y = 9

5 Method 1 Compute the squared deviations, etc. x y 2 3 -3 -6 9 36 18 5
x –x y –y (x –x)2 (y –y)2 (x –x)(y –y) 2 3 -3 -6 9 36 18 5 -2 -4 4 16 8 6 12 1 7 49 28

6 Method 1 Find the sums of the last three columns. x y 2 3 -3 -6 9 36
x –x y –y (x –x)2 (y –y)2 (x –x)(y –y) 2 3 -3 -6 9 36 18 5 -2 -4 4 16 8 6 12 1 7 49 28 30 110 57

7 Method 1 Compute b: Then compute a:

8 Method 2 Consider again the data x y 2 3 5 9 6 12 16

9 Method 2 Compute x2, y2, and xy for each row. x y x2 y2 xy 2 3 4 9 6 5
25 15 81 45 12 36 144 72 16 256

10 Method 2 Then find the sums of x, y, x2, y2, and xy. x y x2 y2 xy 2 3
4 9 6 5 25 15 81 45 12 36 144 72 16 256 25 45 155 515 282

11 Method 2 Then find the sums of x, y, x2, y2, and xy. x y x2 y2 xy 2 3
4 9 6 5 25 15 81 45 12 36 144 72 16 256 x = 25 y = 45 x2 = 155 y2 = 515 xy = 282 25 45 155 515 282

12 Method 2 Compute b: Then compute a:

13 Example The second method is usually easier.
By either method, we get the equation y^ = x.

14 TI-83 – Regression Line On the TI-83, we could use 2-Var Stats to get the basic summations. Then use the formulas for a and b.

15 TI-83 – Regression Line 2-Var Stats L1, L2 reports that Etc., etc.
x = 25 x2 = 155 y = 45 y2 = 515 xy = 282 Etc., etc.

16 TI-83 – Regression Line Or we can use the LinReg function.
Put the x values in L1 and the y values in L2. Select STAT > CALC > LinReg(a+bx). Press Enter. LinReg(a+bx) appears in the display. Enter L1, L2. Press Enter.

17 TI-83 – Regression Line The following appear in the display.
The title LinReg. The equation y = a + bx. The value of a. The value of b. The value of r2 (to be discussed later). The value of r (to be discussed later).

18 TI-83 – Regression Line To graph the regression line along with the scatterplot, Put the x values in L1 and the y values in L2. Select STAT > CALC > LinReg(a+bx). Press Enter. LinReg(a+bx) appears in the display. Enter L1, L2, Y1 Press Enter.

19 TI-83 – Regression Line Press Y= to see the equation.
Press ZOOM > ZoomStat to see the graph.

20 Example Find the equation of the regression line for the Subway data on calories and cholesterol. Calories (x) 350 290 330 320 370 280 310 230 Cholesterol (y) 50 20 45 15 35 25

21 Example 50 40 30 Cholesterol 20 10 Calories 200 250 300 350 400

22 Predicting y How much cholesterol would we expect to find in a Subway sandwich that had 300 calories?

23 Predicting y How much cholesterol would we expect to find in a Subway sandwich that had 300 calories? Enter Y1(300). Press Enter. We get 25.6 calories.

24 Predicting y 50 40 30 Cholesterol 20 10 Calories 200 250 300 350 400

25 SST = Variation in the Data (y’s)
50 40 30 Cholesterol 20 10 Calories 200 250 300 350 400

26 SSR = Variation in the Model
50 40 30 Cholesterol 20 10 Calories 200 250 300 350 400

27 SSE = Residual Sum of Squares
It turns out that SSE = SST – SSR. That is,


Download ppt "Calculating the Least Squares Regression Line"

Similar presentations


Ads by Google