Sta255 Week 12-2 Pre
Sta255 Week 12-2 Pre
Yaoming Zhen
1 / 17
Roadmap
1. Hypothesis test
2 / 17
Type I and II Errors
Example
Suppose the speed limit is 120 km/hr and a device has
recorded the speed of 3 cars. We assume X ∼ N(µ, 4) and we
want to test H0 : µ = 120 vs H1 : µ > 120 with test statistic
T = X1 +X32 +X3 = X̄ .
(a). What values of t will reject H0 for α = 0.05? (z0.05 = 1.64)?
3 / 17
Type I and II Errors
(b). If the police decide to fine drivers going over 121 km/hr,
what is the probability of a tyle I error?
4 / 17
Type I and II Errors
5 / 17
p-values
6 / 17
p-value for Normal Hypothesis Test
X̄ −µ
Test statistic: Z = σ/ n
√0
7 / 17
Normal Hypothesis Test
Example
Suppose that we have data that follows a normal distribution of
unknown mean µ and known variance σ 2 = 4. Let the null
hypothesis be H0 : µ = 0. Let the alternative hypothesis be H1 :
µ > 0. Suppose we collect the following data: 1, 2, 3, 6, -1. At
significance level α = 0.05, should we reject H0 ?
8 / 17
Normal Hypothesis Test with unknown σ 2
X̄ −µ
Test statistic: T = S/ n
√0
9 / 17
Normal Hypothesis Test
Example con’t
Suppose that we have data that follows a normal distribution of
unknown mean µ and unknown variance σ 2 . Let the null
hypothesis H0 be that µ = 0. Let the alternative hypothesis HA
be that µ > 0. Suppose we collect the following data: 1, 2, 3, 6,
-1. At significance level α = 0.05, should we reject H0 ?
10 / 17
Tests for Large Samples
11 / 17
Two-Sample Equal Variances
Xi ∼ N(µx , σ 2 )
Yj ∼ N(µy , σ 2 )
12 / 17
Two-Sample Equal Variances
H0 : For a specified µ0 : µx − µy = µ0
HA : For a specified µ0 : µx − µy ̸= µ0
Test-statistic:
X̄ − Ȳ − µ0
T = q
sp n1 + m1
(n − 1)sx2 + (m − 1)sy2
sp2 =
n+m−2
13 / 17
Two-Sample Equal Variances
Example
Real data from 1408 women admitted to a maternity hospital for
(i) medical reasons or through (ii) unbooked emergency
admission. The duration of pregnancy is measured in complete
weeks from the beginning of the last menstrual period. Medical:
775 obs. with x̄ = 39.08 and sx2 = 7.77 Emergency: 633 obs.
with ȳ = 39.60 and sy2 = 4.95. Set up and run a two-sample
t-test to investigate whether the duration differs for the two
groups.
14 / 17
Two-Sample Equal Variances
15 / 17
Paired Two-Sample T-Test
16 / 17
Paired Two-Sample T-Test
H0 : µ = µ0 .
HA : µ ̸= µ0 .
W̄ −µ
Test statistic: T = √0
S/ n
17 / 17