Two Sample Test
Two Sample Test
Learning Objectives
In this chapter, you learn hypothesis testing
procedures to test:
The means of two independent populations
The means of two related populations
The proportions of two independent
populations
The variances of two independent populations
The means of more than two populations
Chapter Overview
Two-Sample Tests
Population Means,
Independent Samples
Means,
Related Samples
Population
Proportions
Population
Variances
One-Way Analysis
of Variance (ANOVA)
F-test
Tukey-Kramer
test
Two-Sample Tests
Two-Sample Tests
Population
Means,
Independent
Samples
Means,
Related
Samples
Population
Proportions
Population
Variances
Examples:
Mean 1 vs.
independent
Mean 2
Same population
before vs. after
treatment
Proportion 1 vs.
Proportion 2
Variance 1 vs.
Variance 2
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
X1 X2
Independent Samples
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
1 and 2 Known
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
Assumptions:
1 and 2 Known
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
(continued)
X1 X2
2
1
n1
n2
1 and 2 Known
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
(continued)
X
Z
X 2 1 2
2
1
n1
n2
Upper-tail test:
Two-tail test:
H0: 1 2
H1: 1 < 2
H0: 1 2
H1: 1 > 2
H0: 1 = 2
H1: 1 2
i.e.,
i.e.,
i.e.,
H0: 1 2 0
H1: 1 2 < 0
H0: 1 2 0
H1: 1 2 > 0
H0: 1 2 = 0
H1: 1 2 0
Upper-tail test:
Two-tail test:
H0: 1 2 0
H1: 1 2 < 0
H0: 1 2 0
H1: 1 2 > 0
H0: 1 2 = 0
H1: 1 2 0
-z
Reject H0 if Z < -Z
z
Reject H0 if Z > Z
/2
-z/2
/2
z/2
Confidence Interval,
1 and 2 Known
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
2
1
2
X1 X 2 Z
n1
n2
1 and 2 Unknown,
Assumed Equal
Assumptions:
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
1 and 2 Unknown,
Assumed Equal
Forming interval
estimates:
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
(continued)
1 and 2 Unknown,
Assumed Equal
(continued)
Population means,
independent
samples
2
p
n1 1 S
n2 1 S 2
(n1 1) (n2 1)
2
1
1 and 2 Unknown,
Assumed Equal
(continued)
Population means,
independent
samples
X
t
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
X 2 1 2
1 1
S
n1 n2
2
p
2
p
2
2
n1 1 S1 n2 1 S 2
(n1 1) (n2 1)
Confidence Interval,
1 and 2 Unknown
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
X 2 t n1 n2 -2
1 1
S
n1 n2
2
p
Where
2
2
1
S
1
S
1
2
2
S2 1
p
(n1 1) (n2 1)
Pooled-Variance t Test:
Example
You are a financial analyst for a brokerage firm. Is there
a difference in dividend yield between stocks listed on
the NYSE & NASDAQ? You collect the following data:
Number
Sample mean
Sample std dev
NYSE
21
3.27
1.30
NASDAQ
25
2.53
1.16
X
t
X 2 1 2
1 1
S
n1 n2
2
p
2
p
3.27 2.53 0
1
1
1.5021
21 25
2
2
n1 1 S1 n2 1 S 2
21 11.30 2 25 11.16 2
(n1 1) (n2 1)
(21 - 1) (25 1)
2.040
1.5021
Solution
H0: 1 - 2 = 0 i.e. (1 = 2)
Reject H0
Reject H0
H1: 1 - 2 0 i.e. (1 2)
= 0.05
.025
df = 21 + 25 - 2 = 44
-2.0154
.025
0 2.0154
2.040
Decision:
3.27 2.53
t
2.040 Reject H0 at = 0.05
1
1
Conclusion:
1.5021
21 25
There is evidence of a
difference in means.
Test Statistic:
1 and 2 Unknown,
Not Assumed Equal
Assumptions:
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
1 and 2 Unknown,
Not Assumed Equal
Population means,
independent
samples
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
(continued)
1 and 2 Unknown,
Not Assumed Equal
Population means,
independent
samples
(continued)
X X
t
1 and 2 known
1 and 2 unknown,
assumed equal
1 and 2 unknown,
not assumed equal
2
1
2
2
S S
n1 n2
Related Populations
Tests Means of 2 Related Populations
Related
samples
Di = X1i - X2i
Eliminates Variation Among Subjects
Assumptions:
Both Populations Are Normally Distributed
Or, if not Normal, use large samples
1i
2i
D
i 1
(continued)
D D
Z
D
n
Where
D = hypothesized mean difference
D = population standard dev. of differences
n = the sample size (number of pairs)
Confidence Interval, D
Known
Paired
samples
D
DZ
n
Where
n = the sample size
(number of pairs in the paired sample)
Mean Difference, D
Unknown
Related
samples
SD
2
(D
D
)
i
i1
n 1
Mean Difference, D
Unknown
Paired
samples
(continued)
D D
t
SD
n
SD
2
(D
D
)
i
i1
n 1
Confidence Interval, D
Unknown
Paired
samples
SD
D t n1
n
n
where
SD
(D D)
i1
n 1
Upper-tail test:
Two-tail test:
H0: D 0
H1: D < 0
H0: D 0
H1: D > 0
H0: D = 0
H1: D 0
-t
Reject H0 if t < -t
t
Reject H0 if t > t
Where t has n - 1 d.f.
/2
-t/2
/2
t/2
Reject H0 if t < -t
or t > t
6
20
3
0
4
4
6
2
0
0
- 2
-14
- 1
0
- 4
D =
Di
n
= -4.2
SD
-21
2
(D
D
)
i
5.67
n 1
D = - 4.2
Test Statistic:
D D 4.2 0
t
1.66
SD / n 5.67/ 5
Reject
Reject
/2
/2
- 4.604
4.604
- 1.66
Two Population
Proportions
Population
proportions
p1 p2
Two Population
Proportions
Population
proportions
X1 X 2
p
n1 n2
where X1 and X2 are the numbers from
samples 1 and 2 with the characteristic of
interest
Two Population
Proportions
The test statistic for
p1 p2 is a Z statistic:
Population
proportions
where
p1 p2 1 2
1 1
p (1 p)
n1 n2
X1 X 2
X
X
, p1 1 , p 2 2
n1 n2
n1
n2
(continued)
p1 p2
p1(1 p1 ) p 2 (1 p 2 )
Z
n1
n2
Upper-tail test:
Two-tail test:
H0: 1 2
H1: 1 < 2
H0: 1 2
H1: 1 > 2
H0: 1 = 2
H1: 1 2
i.e.,
i.e.,
i.e.,
H0: 1 2 0
H1: 1 2 < 0
H0: 1 2 0
H1: 1 2 > 0
H0: 1 2 = 0
H1: 1 2 0
(continued)
Population proportions
Lower-tail test:
Upper-tail test:
Two-tail test:
H0: 1 2 0
H1: 1 2 < 0
H0: 1 2 0
H1: 1 2 > 0
H0: 1 2 = 0
H1: 1 2 0
-z
Reject H0 if Z < -Z
z
Reject H0 if Z > Z
/2
-z/2
/2
z/2
Reject H0 if Z < -Z
or Z > Z
Example:
Two population Proportions
Is there a significant difference between
the proportion of men and the proportion
of women who will vote Yes on
Proposition A?
Example:
Two population Proportions
(continued)
p1 = 36/72 = .50
Women:
p2 = 31/50 = .62
X1 X 2 36 31 67
p
.549
n1 n2
72 50 122
Example:
Two population Proportions
The test statistic for 1 2 is:
z
p1 p2 1 2
1 1
n1 n2
p (1 p)
.50 .62 0
1
1
72
50
(continued)
Reject H0
Reject H0
.025
.025
-1.96
-1.31
1.96
1.31
.549 (1 .549)