Two Sample Test
Two Sample Test
Two Sample Test
Dung Nguyen
Basic Assumptions
1 X1 , X2 , . . . , Xm is a random sample from a distribution with mean µ1
and variance σ12 .
2 Y1 , Y2 , . . . , Yn is a random sample from a distribution with mean µ2
and variance σ22 .
3 The X and Y samples are independent of one another.
If both X and Y are normal then
(X − Y) − (µ1 − µ2 )
Z= q ∼ N (0, 1)
σ12 σ22
m + n
Solution
We test the following hypotheses
H0 : µ1 − µ2 ≥ 0 vs. H 1 : µ1 − µ 2 < 0 (i.e.µ1 < µ2 )
Compute the statistic
(27.2 − 32.1) − 0
z= q = −2.715
3.82 4.32
12 + 9
Since c = −z0.01 = −2.326 and z < c, we can reject H0 .
Solution
We test the following hypotheses
H 0 : µ1 − µ 2 ≤ 0 vs. H1 : µ1 − µ2 > 0 (i.e. µ1 > µ2 ).
m = n = 10. X = 121, Y = 112. Thus z = 2.52.
Solution
We test the following hypotheses
H0 : µ1 − µ2 ≤ 0 vs. H 1 : µ1 − µ2 > 0 (i.e. µ1 > µ2 )
Compute m = 9, n = 9, x = 35.22, y = 31.56, s1 = 4.94, s2 = 4.48. Thus
(9 − 1)4.942 + (9 − 1)4.482
s2 = = 22.2361
9+9−2
and the statistic
(35.22 − 31.56) − 0
t= q = 1.6495
22.2361 19 + 91
Since c = t0.01,9+9−2 = t0.01,16 = 2.583 > t, we fail reject H0 .
Obs. 1 2 3 4 5 6 7 8
Cat. 1 91.50 94.18 92.18 95.39 91.79 89.07 94.72 89.21
Cat. 2 89.19 90.95 90.46 93.21 97.19 97.04 91.07 92.75
Solution
We test the following hypotheses
H0 : µ1 − µ2 = 0 vs. H1 : µ1 − µ2 6= 0.
x = 92.255, y = 92.733, σx = 2.39, σy = 2.98. Then s2 = 7.30 and t0 = −0.35.
The null hypothesis cannot be rejected.
Solution
q
1 1
s2 = 19.52, =⇒ se = 19.62 10 + 15 = 1.796. Thus
µ1 − µ2 = 90.0 − 87.0 ± (2.069)(1.796)
Example 1
Determine the number of degrees of freedom for the two-sample t
test or CI in each of the following situations:
Example 1
Determine the number of degrees of freedom for the two-sample t
test or CI in each of the following situations:
1 m = 10, n = 10, s1 = 5.0, s2 = 6.0 =⇒ ν = 17.433 ≈ 17.
Example 1
Determine the number of degrees of freedom for the two-sample t
test or CI in each of the following situations:
1 m = 10, n = 10, s1 = 5.0, s2 = 6.0 =⇒ ν = 17.433 ≈ 17.
2 m = 10, n = 15, s1 = 5.0, s2 = 6.0 =⇒ ν = 21.711 ≈ 22.
Solution
We test the following hypotheses
H0 : µ1 = µ2 vs. H1 : µ1 6= µ2
x = 12.5, y = 27.5, s1 = 7.63, s2 = 15.3
=⇒ t0 = −2.77, ν = 13.2 ≈ 13, t0.025,13 = 2.160. Thus we reject the null
hypothesis.
Example 8 -
The void volume within a textile fabric affects comfort,
flammability, and insulation properties. Permeability of a fabric
refers to the accessibility of void space to the flow of a gas or
liquid. An article gave summary information on air permeability
(cm3/cm2/sec) for a number of different fabric types. Consider the
following data on two different types of plain-weave fabric:
Solution
r
0.792 3.592
se = + = 1.162
10 10
2
0.792 3.592
10 + 10
df = = 9.8696
0.792 2 2 2
1
9 10 + 19 3.59
10
Thus
µ1 − µ2 = (51.71 − 136.14) ± (2.228)(1.162).
Summary
Compute
(x − y) − ∆ (x − y) − ∆
z= or t=
se se
Test two means Normal Known σ 2 q
σ12 σ22
se = m + n N(0, 1)
Population Unknown σ 2 q
se = s m1 + 1
n t(m + n − 2)
distribution Equal
Any q
s21 s22
se = + N(0, 1)
m, n 1 m n
where r
(m − 1)s21 + (n − 1)s22
s=
m+n−2
Remark
Let D = X − Y. Then the expected difference is
µD = E(X − Y) = E(X) − E(Y) = µ1 − µ2 .
Then Di ’s constitute a normal random sample with mean µD . Moreover,
D − µD
T= √ ∼ tn−1
sD / n
Hypothesis Testing
H1 Rejection Region
µD 6= ∆0 |T| > tα/2,n−1
Test statistic µD > ∆ 0 T > tα,n−1
D − ∆0 µD < ∆ 0 T < −tα,n−1
T= √
SD / n
Solution
From the column of observed differences, we calculate D = 1.21 and
sD = 12.68. Thus
√
µD = 1.21 ± (1.771)(12.68)/ 14 = [−4.79, 7.21]
Zinc concentration 1 2 3 4 5 6
in bottom water (x) 0.430 0.266 0.567 0.531 0.707 0.716
in surface water (y) 0.415 0.238 0.390 0.410 0.605 0.609
Difference 0.015 0.028 0.177 0.121 0.102 0.107
Solution
We test the following hypotheses
H0 : µ1 − µ2 ≤ 0 vs. H1 : µ1 − µ2 > 0.
D = 0.0917, sD = 0.0607.Compute the statistic
0.0917 − 0
z= √ = 3.6998.
0.0607 6
t0.05 = 2.015 =⇒ Reject H0 .
Solution
p1 − p2 = (0.1176 − 0.0941) ± 1.96(0.0472)
= [−0.0685, 0.1155]
Solution
p̂1 = 27/100 = 0.27, p̂2 = 19/100 = 0.19, m = n = 100. Then
19 + 27 p
p= = 0.23 and SE = 0.23(1 − 0.23)(1/100 + 1/100) = 0.0595.
100 + 100
Since z0 = 1.34 and z0.025 = 1.96, we cannot reject the null hypothesis.
Dung Nguyen Probability and Statistics 39/40
Analysis of Paired Data Inferences for Population Proportions (Large-Sample)
This interval can safely be used as long as mp̂1 , m q̂1 , nq̂2 , and nq̂2
are all at least 10.
This interval can safely be used as long as mp̂1 , m q̂1 , nq̂2 , and nq̂2
are all at least 10.
A one-sided confidence bound results from retaining the
relevant sign and replacing zα/2 by zα .
This interval can safely be used as long as mp̂1 , m q̂1 , nq̂2 , and nq̂2
are all at least 10.
A one-sided confidence bound results from retaining the
relevant sign and replacing zα/2 by zα .
The estimated standard deviation of (p̂1 − p̂2 ) is different here
from what it was for hypothesis testing when ∆0 = 0.