SimpleLinearRegression 150107
SimpleLinearRegression 150107
Dave Goldsman
1/7/15
Goldsman 1/7/15 1 / 25
Outline
2 Basic Properties
Goldsman 1/7/15 2 / 25
Simple Linear Regression Model
Example:
xi = height of person i
yi = weight of person i
Can we make a model expressing yi as a function of xi ?
Goldsman 1/7/15 3 / 25
Simple Linear Regression Model
Estimate yi for fixed xi . Let’s model this with the simple linear
regression equation,
yi = β0 + β1 xi + εi ,
where β0 and β1 are unknown constants and the error terms are
usually assumed to be
iid
ε1 , . . . , εn ∼ N (0, σ 2 ) ⇒ yi ∼ N (β0 + β1 xi , σ 2 ).
Goldsman 1/7/15 4 / 25
Simple Linear Regression Model
y = β0 + β1 x
with “high” σ 2
y = β0 + β1 x
with “low” σ 2
Goldsman 1/7/15 5 / 25
Simple Linear Regression Model
Goldsman 1/7/15 6 / 25
Simple Linear Regression Model
xi yi
Production Electric Usage
($ million) (million kWh)
Goldsman 1/7/15 7 / 25
Simple Linear Regression Model
3.4
yi 3.0
2.6
2.2
xi
Great... but how do you fit the line?
Goldsman 1/7/15 8 / 25
Simple Linear Regression Model
(x1 , y1 ), . . . , (xn , yn )
by finding the “best” match between the line and the data. The
“best”choice of β0 , β1 will be chosen to minimize
n
X n
X
2
Q= (yi − (β0 + β1 xi )) = ε2i .
i=1 i=1
Goldsman 1/7/15 9 / 25
Simple Linear Regression Model
∂Q P
∂β1 = −2 xi (yi − (β0 + β1 xi )) = 0
P P
⇔ yi = nβ0 + β1 xi
P P
xi y i = xi (yi − (β0 + β1 xi )) = 0
1 P 1 P
β̂0 = ȳ − β̂1 x̄, where ȳ ≡ n yi and x̄ ≡ n xi .
Goldsman 1/7/15 10 / 25
Simple Linear Regression Model
P P
Sxy = (xi − x̄)yi = (xi − x̄)(yi − ȳ)
P P P P
( xi )( yi )
= xi yi − nx̄ȳ = xi y i − n
Goldsman 1/7/15 11 / 25
Simple Linear Regression Model
Sxy
β̂1 =
Sxx
Fact: If the εi ’s are iid N (0, σ 2 ), it can be shown that βˆ0 and β̂1 are the
maximum likelihood estimators for β̂0 and β̂1 , respectively. (See any
text for easy proof).
ŷ = β̂0 + β̂1 x.
Goldsman 1/7/15 12 / 25
Simple Linear Regression Model
ŷ = β̂0 + β̂1 x
ŷ|x∗
x
x ∗
xi
Goldsman 1/7/15 13 / 25
Simple Linear Regression Model
Notation Summary: For actual data points xi , the fitted values are
ŷi = β̂0 + β̂1 xi .
observed values : yi = β0 + β1 xi + εi
Goldsman 1/7/15 14 / 25
Simple Linear Regression Model
Example: Suppose
12
X X
n = 12, xi = 58.62, yi = 34.15,
i=1
X X X
x2i = 291.231, yi2 = 98.697, xi yi = 169.253
These give β̂0 = 0.4090 and β̂1 = 0.49883, and so the fitted regression
line is
ŷ = 0.409 + 0.499x.
Goldsman 1/7/15 15 / 25
Basic Properties
Outline
2 Basic Properties
Goldsman 1/7/15 16 / 25
Basic Properties
Goldsman 1/7/15 17 / 25
Basic Properties
Goldsman 1/7/15 18 / 25
Basic Properties
While we’re at it, we can do the same kind of thing with the intercept
parameter, β0 :
β̂0 = ȳ − β̂1 x̄.
We have
Goldsman 1/7/15 19 / 25
Basic Properties
Proof:
1 P
Cov(ȳ, β̂1 ) = Sxx Cov(ȳ, (xi − x̄)yi )
P
(xi −x̄)
= Sxx Cov(ȳ, yi )
P
(xi −x̄) σ2
= Sxx n = 0
P
x2
Thus, β̂0 ∼ N (β0 , nSxxi σ 2 ).
Goldsman 1/7/15 20 / 25
Basic Properties
SSE σ 2 χ2 (n − 2)
σ̂ 2 ≡ ∼ .
n−2 n−2
Goldsman 1/7/15 21 / 25
Confidence Intervals and Inference for β0 and β1
Outline
2 Basic Properties
Goldsman 1/7/15 22 / 25
Confidence Intervals and Inference for β0 and β1
β̂1 − β1
⇒p ∼ N (0, 1)
σ 2 /Sxx
In addition, it turns out:
SSE σ2 χ2 (n−2)
(1) σ̂ 2 = n−2 ∼ n−2 ;
Goldsman 1/7/15 23 / 25
Confidence Intervals and Inference for β0 and β1
t(n − 2)
1−α
−tα/2,n−2 tα/2,n−2
Goldsman 1/7/15 24 / 25
Confidence Intervals and Inference for β0 and β1
Goldsman 1/7/15 25 / 25