Gr5205 Midterm Key
Gr5205 Midterm Key
Gr5205 Midterm Key
UNI:
The GU5205 midterm is closed notes and closed book. Calculators are allowed. Tablets,
phones, computers and other equivalent forms of technology are strictly prohibited. Students
are not allowed to communicate with anyone with the exception of the TA and the professor.
If students violate these guidelines, they will receive a zero on this exam and potentially
face more severe consequences. Students must include all relevant work in the handwritten
problems to receive full credit.
x̄2 2
✓ ◆
1
(2) E[ ˆ0 ] = 0, E[ ˆ1 ] = 1, V ar[ ˆ0 ] = 2
+ , V ar[ ˆ1 ] = .
n Sxx Sxx
For this exercise, use the scalar form of the simple linear regression model, i.e.,
don’t use matrices.
Part A (5 pts)
Under model (1), prove that ˆ0 ˆ1 is an unbiased estimator of 0 1. Note that you can
directly use the relations from (2).
ECB ]
E[p^o ]
-
E[ fo
-
B ] ,
=
,
=
Pi
-
po
1
Note that
§ ,
=
§,KiYi , Ki=×ij,÷ .
Cov ( Y
,
that
}
Note,
)
under
=
Cov
model
( ±¥,Yi
11 )
,
,
?IkiYi )
( Yi )
=
tn¥¥ ,
kjcov
Yj ,
t.IS.K;Cw(
Yi
=
in
¥ ,
Kiraly ;) + ,Yjl
=
02 In
-2k ;
= 0
Then
covlt -
F. I F )
Covcpo B.)
,
= ,
= covet ,i3i )
-
Ecov ( B ,1& )
,
= 0 - Ivar ( § ) ,
-
o
=
-
× -
2 Sxx
=o?ktE÷l+EI→*fx¥ )
=O?(tn+st×alx2+2xti] )
=oytn+kE¥ )
if students
credit
Give partial
wrote
varciooip .
]=o?( It ¥1 ) .
2*co✓lpo,p .
)
IF Ho is true =o
po p
-
T .
Stat ,
,
Pri
-
ECFO 'M Fo Fi
=§o
-
-
=
T
vampire ,
) nsetkt 'tI¥ )
T ~
t(df=n -
2)
F- test
do = F B. I
§
-
ML -
Estimators :
,
=
55×4 ,
)2 SSE
SSEF
=
If ( Y; -
pro -
§ ,
x :
=
dff =
n
-
2
Reduced Under Ho =p
:p .
,
Y =p +
p Xi +
E =
( ITXI ) + E eiiitvlo ,o2 )
B.
, ;
; , ,
ML
-
Estimator
§ =
ICXITDYIZCX 2
;
+ 1)
SSER =
E. ( Y ;
-
Fx )2 ;
dfr = n -
1
F- statistic
( SSER E) -
Ss 11
F =
5 SE
F ~
f( df = 1
dfz = n -2 )
,
,
Using the R code and output displayed on pages 6, 7 and 8, test the if the intercept statis-
tically differs from the slope, i.e., test the null/alternative pair:
H0 : 0 = 1 versus HA : 0 6= 1.
To receive full credit, compute both the T-statistic and F-statistic for testing the above
null/alternative pair. Also compute the correct p-value and state the statistical conclusion.
Write the solution on the top of page 7.
Note:
1-pt(t.calc,98)=0.1185218 1-pf(f.calc,1,98)=0.2370437
1-pt(t.calc,99)=0.1185074 1-pf(f.calc,1,99)=0.2370147
Fstat
= 1.18899
98 ) = 2*-11852
Prvahe
1.18899 =2*pt(
,x ,
= 2370436
F- Stat
" 242.76 -
239.31
" EF SSE
fan
Ers
= ,= =
.
÷ -
98 2.44
taiIIEE÷÷¥yIIiEY÷¥÷n =
1.4139
) =
2370437
P .
value =
pt ( 1.4139 ,
1,98
from the
> mean(Y) slope .
[1] 4.9012
> sum((x-mean(x))^2)
[1] 834.4460
sxx Also note :
7
1.188992=1.4139
✓
> summary(lm(Y~x))
Bo
:
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.1708 0.3144 3.725 0.000327 ***
x 0.7398 0.0541 13.676 < 2e-16 ***
B .
> anova(lm(Y~x))
> anova(lm(Y~x-1))
aER
8
X Y X Y X Y X Y X Y
Pre Post Pre Post Pre Pos Pre Pos Pre Pos
4.34 1.30 1.55 0.93 7.18 5.10 6.94 2.29 4.00 1.44
3.50 0.94 10.56 4.44 8.33 4.16 6.10 4.75 4.10 1.11
.. .. .. .. .. .. .. .. .. ..
. . . . . . . . . .
.. .. .. .. .. .. .. ..
. . . . . . 7.35 2.35 . .
.. .. .. .. .. ..
. . . . 6.30 4.84 . .
1.90 0.93 9.58 4.22 5.54 2.93
n1 = 10 n2 = 10 n3 = 9 n4 = 8 n5 = 10
iid 2
i = 1, . . . , 47, ✏i ⇠ N (0, ),
where ( (
1 if .1 micro grams 1 if .5 micro grams
Di1 = , Di2 =
0 if otherwise 0 if otherwise
( (
1 if 1 micro grams 1 if 2 micro grams
Di3 = , Di4 =
0 if otherwise 0 if otherwise
Ho :p ,
=
Pa =P ]= 134=0
to
HA : At least are
Pj .
Full model
Y=
pot p ,
D. +
p , Dst 1331>3+134 By +
PSX + E
df h -
6 =
,==
Reduced Model
-2
Y= potpsx + { dfr= n =
4s
SSER -
SSEF SSEF
fan =
dfr -
dff Tff
=
29.34931 20.12544 20.12544
-
its -
4 1 41
=
4.698
P -
valve = 1 -
pf ( 4.698 4,41 ) =
-003262.05
,
at 5% significance Conclude
Reject Ho .
10
that THC levels statistically
dosage
inference
post
-
loco motor
activity ,
after
O
[1] 20.12544 SSE
,=
= SSE
> summary(full.model)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.37384 0.27689 -1.350 0.1844
D1 0.61834 0.32855 1.882 0.0669 .
D2 1.45653 0.35656 4.085 0.0002 ***
D3 0.66599 0.34231 1.946 0.0586 .
D4 0.21998 0.31456 0.699 0.4883
X 0.43466 0.04918 8.838 4.84e-11 ***
---
Residual standard error: 0.7006 on 41 degrees of freedom
Multiple R-squared: 0.8042,Adjusted R-squared: 0.7803
F-statistic: 33.67 on 5 and 41 DF, p-value: 1.704e-13
0
[1] 29.34931 SSER
> reduced.2 <- lm(Y~D1+D2+D3+D4,data=THC.Data)
> sum(residuals(reduced.2)^2)
[1] 58.4661
> 1-pf(f.calc,1,41)
[1] 0.03606229
> 1-pf(f.calc,3,41)
[1] 0.006554796
> 1-pf(f.calc,4,41)
C) p value
.
[1] 0.003256544
11
th
> confint(model.1,level=1-.05/2)
1.25 % 98.75 %
(Intercept) -1.0180992 0.2704152
D1 -0.1461084 1.3827809
D2 0.6269190 2.2861442
D3 -0.1304642 1.4624432 -
> confint(model.1,level=1-.05/4)
=>
0.625 % 99.375 % level =L -
-0514
(Intercept) -1.0972852 0.3496011
¥
D1 -0.2400666 1.4767392
D2 0.5249510 2.3881122
D3 -0.2283567 1.5603357
D4 -0.6018672 1.0418337
X 0.3061627 0.5631544
"
> confint(model.1,level=1-.05/8)
D1
0.312 % 99.688 %
(Intercept) -1.1720667 0.4243826
-0.3287988 1.5654713
wnmsg
!gIikInt
D2 0.4286546 2.4844086 THC level
D3 -0.3208042 1.6527832
dosage .
D4 -0.6868210 1.1267874
X 0.2928803 0.5764369
> confint(model.1,level=1-.05/10)
0.25 % 99.75 %
(Intercept) -1.1953778 0.4476938
D1 -0.3564587 1.5931312
D2 0.3986367 2.5144265
D3 -0.3496223 1.6816013
D4 -0.7133031 1.1532696
X 0.2887398 0.5805773
12