calculating the least squares regression line
DESCRIPTION
Calculating the Least Squares Regression Line. Lecture 49 Secs. 13.3.2 Fri, Apr 28, 2006. 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. Example. - PowerPoint PPT PresentationTRANSCRIPT
Calculating the Calculating the Least Squares Least Squares
Regression LineRegression LineLecture 49Lecture 49
Secs. 13.3.2Secs. 13.3.2
Fri, Apr 28, 2006Fri, Apr 28, 2006
The Least Squares The Least Squares Regression LineRegression Line
The equation of the regression line is The equation of the regression line is
yy^̂ = = aa + + bxbx.. Thus, we need to find the Thus, we need to find the
coefficients coefficients aa and and bb.. The formulas areThe formulas are
xbya
xx
yyxxb
2 xbya
xxn
yxxynb
22or
ExampleExample
Consider again the data setConsider again the data set
x y
2 3
3 5
5 9
6 12
9 16
Method 1Method 1
Compute the means and deviations Compute the means and deviations for for xx and and yy..
x y x –x y –y
2 3 -3 -6
3 5 -2 -4
5 9 0 0
6 12 1 3
9 16 4 7
x = 5
y = 9
Method 1Method 1
Compute the squared deviations, Compute the squared deviations, etc.etc.
x y x –x y –y (x –x)2 (y –y)2
(x –x)(y –y)
2 3 -3 -6 9 36 18
3 5 -2 -4 4 16 8
5 9 0 0 0 0 0
6 12 1 3 1 9 3
9 16 4 7 16 49 28
Method 1Method 1
Find the sums of the last three Find the sums of the last three columns.columns.
x y x –x y –y (x –x)2 (y –y)2
(x –x)(y –y)
2 3 -3 -6 9 36 18
3 5 -2 -4 4 16 8
5 9 0 0 0 0 0
6 12 1 3 1 9 3
9 16 4 7 16 49 2830 110 57
Method 1Method 1
Compute Compute bb::
Then compute Then compute aa::
9.130
57b
5.059.19 a
Method 2Method 2
Consider again the dataConsider again the data
x y
2 3
3 5
5 9
6 12
9 16
Method 2Method 2
Compute Compute xx22, , yy22, and , and xyxy for each row. for each row.
x y x2 y2 xy
2 3 4 9 6
3 5 9 25 15
5 9 25 81 45
6 12 36 144
72
9 16 81 256
144
Method 2Method 2
Then find the sums of Then find the sums of xx, , yy, , xx22, , yy22, and , and xyxy..
x y x2 y2 xy
2 3 4 9 6
3 5 9 25 15
5 9 25 81 45
6 12 36 144
72
9 16 81 256
144
155 515 28225 45
Method 2Method 2
Then find the sums of Then find the sums of xx, , yy, , xx22, , yy22, and , and xyxy..
x y x2 y2 xy
2 3 4 9 6
3 5 9 25 15
5 9 25 81 45
6 12 36 144
72
9 16 81 256
144
155 515 282
x = 25y = 45x2 = 155y2 = 515xy = 282
25 45
Method 2Method 2
Compute Compute bb::
Then compute Then compute aa::
9.1150
285
251555
452528252
b
5.059.195
259.1
5
45
a
ExampleExample
The second method is usually easier.The second method is usually easier. By either method, we get the By either method, we get the
equationequation
yy^̂ = -0.5 + 1.9 = -0.5 + 1.9xx..
TI-83 – Regression LineTI-83 – Regression Line
On the TI-83, we On the TI-83, we couldcould use 2-Var Stats use 2-Var Stats to get the basic summations. Then use to get the basic summations. Then use the formulas for the formulas for aa and and bb..
For our example, 2-Var Stats LFor our example, 2-Var Stats L11, L, L22 reports thatreports that nn = 5 = 5 xx = 25 = 25 xx22 = 155 = 155 yy = 45 = 45 yy22 = 515 = 515 xyxy = 282 = 282
TI-83 – Regression LineTI-83 – Regression Line
Or we can use the LinReg function.Or we can use the LinReg function. Put the Put the xx values in L values in L11 and the and the yy values values
in Lin L22.. Select STAT > CALC > LinReg(a+bx).Select STAT > CALC > LinReg(a+bx). Press Enter. LinReg(a+bx) appears in Press Enter. LinReg(a+bx) appears in
the display.the display. Enter LEnter L11, L, L22.. Press Enter.Press Enter.
TI-83 – Regression LineTI-83 – Regression Line
The following appear in the display.The following appear in the display. The title LinReg.The title LinReg. The equation y = a + bx.The equation y = a + bx. The value of The value of aa.. The value of The value of bb.. The value of The value of rr22 (to be discussed later). (to be discussed later). The value of The value of rr (to be discussed later). (to be discussed later).
TI-83 – Regression LineTI-83 – Regression Line
To graph the regression line along with To graph the regression line along with the scatterplot,the scatterplot, Put the Put the xx values in L values in L11 and the and the yy values in L values in L22.. Select STAT > CALC > LinReg(a+bx).Select STAT > CALC > LinReg(a+bx). Press Enter. LinReg(a+bx) appears in the Press Enter. LinReg(a+bx) appears in the
display.display. Enter LEnter L11, L, L22, Y, Y11
Press Enter.Press Enter. Press Y= to see the equation.Press Y= to see the equation. Press ZOOM > ZoomStat to see the graph. Press ZOOM > ZoomStat to see the graph.