Tutorial1_estimates(1)
Tutorial1_estimates(1)
Tutorial 1: Estimates
1 Abbreviation
For simple linear regression, yi = 0 + 1 xi + "i , i = 1, 2, ..., n.
n n
1X 1X
ȳ = yi , x̄ = xi ,
n n
i=1 i=1
n
X Xn
SY Y = (yi ȳ)2 = yi2 nȳ 2 ,
i=1 i=1
n
X Xn
SXX = (xi x̄)2 = x2i nx̄2 ,
i=1 i=1
n
X n
X
SXY = (xi x̄) (yi ȳ) = x i yi nx̄ȳ,
i=1 i=1
n
X n
X
ˆ0 ˆ1 xi )2 = SY Y SXY 2 ˆ2 SXX.
RSS = "ˆ2i = (yi = SY Y 1
SXX
i=1 i=1
1
STAT 3008 Applied Regression Analysis
Tutorial 1: Estimates
1 Abbreviation
For simple linear regression, yi = 0 + 1 xi + "i , i = 1, 2, ..., n.
n n
1X 1X
ȳ = yi , x̄ = xi ,
n n
i=1 i=1
n
X Xn
SY Y = (yi ȳ)2 = yi2 nȳ 2 ,
i=1 i=1
n
X Xn
SXX = (xi x̄)2 = x2i nx̄2 ,
i=1 i=1
n
X n
X
SXY = (xi x̄) (yi ȳ) = x i yi nx̄ȳ,
i=1 i=1
n
X n
X
ˆ0 ˆ1 xi )2 = SY Y SXY 2 ˆ2 SXX.
RSS = "ˆ2i = (yi = SY Y 1
SXX
i=1 i=1
1
STAT 3008 Applied Regression Analysis
Tutorial 1: Estimates
1 Abbreviation
For simple linear regression, yi = 0 + 1 xi + "i , i = 1, 2, ..., n.
n n
1X 1X
ȳ = yi , x̄ = xi ,
n n
i=1 i=1
n
X Xn
SY Y = (yi ȳ)2 = yi2 nȳ 2 ,
i=1 i=1
n
X Xn
SXX = (xi x̄)2 = x2i nx̄2 ,
i=1 i=1
n
X n
X
SXY = (xi x̄) (yi ȳ) = x i yi nx̄ȳ,
i=1 i=1
n
X n
X
ˆ0 ˆ1 xi )2 = SY Y SXY 2 ˆ2 SXX.
RSS = "ˆ2i = (yi = SY Y 1
SXX
i=1 i=1
1
3 Maximum Likelihood Estimates (MLE)
Maximize the (log-)likelihood function to get estimates of parameters. The log-likelihood
function is given as
l(✓; x, y) = log(L(✓; x, y)) = log(f (x, y; ✓)).
Q
n
If i.i.d. sample, then f (x, y; ✓) = f (xi , yi ; ✓).
i=1
For simple linear regression, we have
n
2 2 n n 2 1 X 2
l 0, 1, = log L 0, 1, = log(2⇡) log 2
(yi 0 1 xi ) .
2 2 2
i=1
@l @l @l
Set @ 0 ˜ , ˜ ,˜ 2 = @ 1 ˜ , ˜ ,˜ 2 = @ 2 ˜0 , ˜1 ,˜ 2
= 0, then we can get the estimates as
0 1 0 1
˜1 = SXY = ˆ1 ,
SXX
˜0 = ȳ ˜1 x̄ = ˆ0 ,
⇣ ⌘
SXY 2
˜ 2 = n1 SY Y SXX = n 2 2
n ˆ .
4 Coefficient Table
iid 2
For the simple linear regression, yi = 0 + 1 xi + "i , "i ⇠ N 0, .
The hypothesis testing is conducted on hypotheses including H0 : = ⇤ and H1 : 6= ⇤
1 1 1 1.
ˆ1 ⇤
Under H0 , t statistics is given as t0 = 1
⇠ tn 2.
se( ˆ1 )
It is a two-sided test, then p-value = 2 Pr(tn 2 > |t0 |).
If we set ⇤ = ⇤ = 0 and then derive the t statistics t0 for the following coefficient table.
0 1
2
5 Properties of the LSE
For the simple linear regression:
iid 2
yi = 0 + 1 xi + "i , "i ⇠ N 0, .
• Property 2: The fitted line ŷ = ˆ0 + ˆ1 x always passed through the average point (x̄, ȳ).
Extension: Suppose the following regression model is fitted to a data set with observations
{(xi , yi ), i = 1, 2, ..., n}:
iid 2
yi = xi + "i , "i ⇠ N 0, . (5.1)
6 Exercise
Problem 1. Suppose the following regression model is fitted to a data set with observations
{(xi , yi ), i = 1, 2, ..., n}:
iid 2
yi = x i + "i , "i ⇠ N 0, .
but (ii) does not pass through the average point (x̄, ȳ).
(d) Maximum likelihood estimates (MLE) for and 2.
3
Problem 2. Simple linear regression model with x1 = a and x2 = ... = xn = a + nb.
(a) Show that SXX = n(n 1)b2 .
(b) OLS estimate for 1. ⇣ ⌘
ȳ y1
(c) Consider if the regression line passes through the point (x, y) = a + nb, ȳ + n 1 .
4
a) RSS = (y= Bx )
-
=
RSS2(i) lyil
Ci (y -)=
= 0
=
-Xin -1)
E(() = n -
1
2= El
inyz- )
--
E(5k) :
i
STAT 3008 Applied Regression Analysis
Tutorial 1 Solution
Problem 1.
(a)
n
X
g( ) = (yi xi ) 2
i=1
n
X
dg
= 2 xi (yi xi )
d
i=1
Pn
dg ˆ x i yi
= 0 ) = Pi=1 n 2
d i=1 xi
RSS
Since 2
⇠ x2n 1 ,
✓ ◆ ✓ ◆
RSS 2 RSS
E 2
=n 1) =E
n 1
n
" Pn #2
RSS 1 X j=1 x j y j
ˆ2 = = yi x i P n 2
n 1 n 1 j=1 xj
i=1
(b) Pn Pn
x i E (y i ) x ( x)
E( ˆ | x) = i=1
Pn 2
Pn i 2 i =
= i=1
i=1 xi i=1 xi
(c)
Pn X n ⇣ ⌘
ˆx¯2 = Pi=1 xi yi x̄2 = 1 x y
i i ) pass through x 2 , xy
n 2
i=1 xi n
i=1
Pn
ˆx̄ = Pi=1 xi yi (x̄) 6= ȳ. ) do not pass through (x̄, ȳ)
n 2
i=1 xi
.
(d)
@l , 2 @l , 2
2
l , ) = 2
=0
@ @
( ˜,˜ 2 ) ( ˜,˜ 2 )
Pn n Pn !2
˜ x i yi RSS 1X j=1 xj yj
) = Pi=1
n 2 , ˜2 = = yi xi Pn 2
i=1 xi n n j=1 xj
i=1
Problem 2. Pn
(a) x̄ = a + (n 1)b ) SXX = i=1 (xi x̄)2 = n(n 1)b2
1
(b)
n
X
SXY = (xi x̄) (yi ȳ)
i=1
n
X
= (a x̄) (y1 ȳ) + (a + nb x̄) (yi ȳ)
i=2
n
X
= (n 1)b (y1 ȳ) + b (yi ȳ)
i=2
n
X
= nb (ȳ y1 ) (* yi = nȳ y1 )
i=2
) ˆ1 = SXX
SXY
= (nȳ y1)b
1
Problem 3.
1 X⇣ ⌘ ⇣ ⌘
n
ê¯ = yi ˆ0 ˆ1 xi = ȳ ȳ ˆ1 x̄ ˆ1 x̄ = 0
n
i=1
n
X n
X
(xi x̄) êi ê¯ = (xi x̄) êi
i=1 i=1
Xn ⇣ ⌘
= (xi x̄) yi ˆ0 ˆ1 xi
i=1
n
X ⇣ ⇣ ⌘ ⌘
= (xi x̄) yi ȳ ˆ1 x̄ ˆ1 xi
i=1
n
X n
X
= (xi x̄) (yi ȳ) ˆ1 (xi x̄)2
i=1 i=1
SXY
= SXY SXX = 0
SXX