Simple Linear Regression
Simple Linear Regression
y = 0 + 1 x
1 : The slope
Sales = 0 + 1 (Advertising)
X : student population
y : quarterly sales
Simple Linear Regression Model
y = 0 + 1 x +
Mean ( ) = 0
Therefore,
Mean (y ) = 0 + 1 x
The actual y for any given x has normal distribution with mean
of + x and a standard deviation of standard error.
Simple Linear Regression Equation
For the time being forget . The following equation describes how
the mean value of y is related to x.
E (y ) = 0 + 1 x
1 > 0 1 < 0 1 = 0
Estimated Linear Regression Equation
If we knew the values of 0 and 1 then given any campus
population, we could plug it into the equation and find the mean
value of the sales.
E (y ) = 0 + 1 x
We estimate 0 by b0 and 1 by b1
Estimated Linear Regression Equation
Simple Linear Equation
E (y ) = 0 + 1 x
Regression model X y
y = 0 + 1 x + x1 y1
Regression equation x2 y2
E (y ) = 0 + 1 x . .
Unknown . .
0 and 1 xn yn
Then we measure the intersection with y axis and that is b0, and
the slope is b1
Graphical - Judgmental Solution
Y = 55+6x
1 b1
b0
The Least Square Method
Our judgmental approach and our eyes tried to minimize the
difference between observed values and values obtained on the
estimated regression line.
yi xi yˆ i
y1 x1 b0 b1 x1
y2 x2 b0 b1 x2
y3 x3 b0 b1 x3
. . .
. . .
yn xn b0 b1 xn
n
Min Z (y i y i ) 2
i 1
n
Min Z (y i b0 b1 x i ) 2
i 1
Classic Minimization
n
Min Z (y i b0 b1 x i ) 2
i 1
n
Z (y i b0 b1 x i ) 2
i 1
i 1
Z n
2( 1 )( y i b0 b1 x i ) 0
b0 i 1
Z n
2( x i )( y i b0 b1 x i ) 0
b1 i 1
B0 and b1
b1
xy ( x y ) / n
x ( x ) / n
2 2
b0 y b1 x
Example
Restaurant i xi yi xi yi xi2
1 2 58 116
2 6 105 630 4
3 8 88 704 36
4 8 118 944 64
5 12 117 1404 64
6 16 137 2192 144
7 20 157 3140 256
8 20 169 3380 400
9 22 149 3278 400
10 26 20 5252 484
676
b1
xy ( x y ) / n
x ( x ) / n
2 2
2840
b1 5
568
b0
y b0 b1 x
1300
y 130
10
140
x 14
10
130 b0 5 ( 14 )
b0 60
Estimated Regression Equation
y 60 5 x
y 60 5 ( 16 )
y 140 thousand dollars
Summary ; The Simple Linear Regression Model
where
yi = observed value of the dependent variable
for the i th observation
ŷi = estimated value of the dependent variable
for the i th observation
Summary ; The Least Square Method
b1
x y ( x y )/ n
i i i i
x ( x ) / n
2
i i
2
b0 y b1 x
30
25
20
15 X
10
0
0 0.5 1 1.5 2 2.5 3 3.5
Example : Read Auto Sales
Y X
14 1
24 3
18 2
17 1
27 3
Y X XY X2
14 1 14 1
24 3 72 9
18 2 36 4
17 1 17 1
27 3 81 9
Example : Read Auto Sales
Y X XY X2
14 1 14 1
24 3 72 9
18 2 36 4
17 1 17 1
27 3 81 9
Sum 100 10 220 24
Example : Read Auto Sales
SSE = (y - ŷ )2
SSE : Pictorial Representation
y10 - ^y10
Y = 60+5x
SSE Computations
i xi yi
1 2 58
2 6 105
3 8 88
4 8 188
5 12 117
6 16 137
7 20 157
8 20 169
9 22 149
10 26 202
SSE Computations
i xi yi ŷi = 60 + 5xi
1 2 58 70
2 6 105 90
3 8 88 100
4 8 188 100
5 12 117 120
6 16 137 140
7 20 157 160
8 20 169 160
9 22 149 170
10 26 202 190
SSE Computations
i xi yi ŷi = 60 + 5xi (yi - ŷi ) (yi- ŷi )2
1 2 58 70 -12 144
2 6 105 90 15 225
3 8 88 100 -12 144
4 8 188 100 18 324
5 12 117 120 -3 9
6 16 137 140 -3 9
7 20 157 160 -3 9
8 20 169 160 9 81
9 22 149 170 -21 441
10 26 202 190 12 144
SSE Computations
i xi yi ŷi = 60 + 5xi (yi - ŷi ) (yi- ŷi )2
1 2 58 70 -12 144
2 6 105 90 15 225
3 8 88 100 -12 144
4 8 118 100 18 324
5 12 117 120 -3 9
6 16 137 140 -3 9
7 20 157 160 -3 9
8 20 169 160 9 81
9 22 149 170 -21 441
10 26 202 190 12 144
y = ( yi) / n
y = 1300/10 =
130
This is our estimate for the next value of y.
Given an observation with values of yi and xi.
(yi –y ) is the error in using x to estimate yi.
SST = (y - y )2
SST : Pictorial Representation
y10 - y
yi = 130
SST Computations
i xi yi (yi - ) (yi - y)2 y
1 2 58 -72 5184
2 6 105 -25 625
3 8 88 -42 1764
4 8 188 -12 144
5 12 117 -13 169
6 16 137 7 49
7 20 157 27 729
8 20 169 39 1521
9 22 149 19 361
10 26 202 72 5184
SSE = SST
1 r2 0
r2 = 14200/15730 = .9027
SST ( y y ) 2
SST y 2 ( y ) 2 / n
SST Calculations
SST y 2 ( y ) 2 / n
Observation Xi yi yi^2
1 2 58 3364
2 6 105 11025
3 8 88 7744
4 8 118 13924
5 12 117 13689
6 16 137 18769
7 20 157 24649
8 20 169 28561
9 22 149 22201
10 26 202 40804
1300 184730
SST 184730 ( 1300 ) 2 / 10 15730
SSR Calculations
SSR
xy ( x y ) / n
2
x x / n
2 2
r 2 .9027
SSR
xy ( x y ) / n
2
SST y 2 ( y ) 2 / n
x x / n
2 2
x y xy x2 y2
1 14 14 1 196
3 24 72 9 576
2 18 36 4 324
1 17 17 1 289
3 27 81 9 729
SSR
xy ( x y ) / n
2
SST y 2 ( y ) 2 / n
x x / n
2 2
x = 10
y = 100
xy = 220
x2 = 24
y2 = 2114
24 10 / 5
2
SST 114
SSR
220 200
2
100
24 20
Example : Read Auto Sales
Alternatively; we could compute SSE and SST and then find
SSR = SST -SSE
rxy ( sign of b1 ) r 2
rxy ( sign of b1 ) r 2
rxy .9027
rxy .9501
Page 573
Problems 15
Problems 17
Problems 18