Chapter 4 Two-Sample Tests
Chapter 4 Two-Sample Tests
12th Edition
Chapter 4
Two-Sample Tests
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-1
Learning Objectives
In this chapter, you learn how to use hypothesis
testing for comparing the difference between:
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-2
Two-Sample Tests
DCOVA
Two-Sample Tests
Population Population
Means, Means, Population Population
Independent Related Proportions Variances
Samples Samples
Examples:
Group 1 vs. Same group Proportion 1 vs. Variance 1 vs.
Group 2 before vs. after Proportion 2 Variance 2
treatment
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-3
Difference Between Two Means
DCOVA
X1 – X2
σ1 and σ2 unknown,
not assumed equal
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-4
Difference Between Two Means:
Independent Samples DCOVA
Different data sources
Population means, Unrelated
independent
samples
* Independent
Sample selected from one
population has no effect on the
sample selected from the other
population
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-6
Hypothesis tests for μ1 – μ2
DCOVA
Two Population Means, Independent Samples
Lower-tail test: Upper-tail test: Two-tail test:
H0: μ1 – μ2 0 H0: μ1 – μ2 ≤ 0 H0: μ1 – μ2 = 0
H1: μ1 – μ2 < 0 H1: μ1 – μ2 > 0 H1: μ1 – μ2 ≠ 0
a a a/2 a/2
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-7
Hypothesis tests for µ1 - µ2 with σ1
and σ2 unknown and assumed equal
DCOVA
(n1 1) (n 2 1)
p
samples
Population means,
independent
samples
The confidence interval for
μ1 – μ2 is:
σ1 and σ2 unknown, *
X
assumed equal 1 1
1 X 2 ta/2 S
2
p
n1 n 2
t STAT
X 1
X 2 μ1 μ 2
3.27 2.53 0 2.040
1 1 1 1
S
2
1.5021
21 25
p
n1 n 2
n
S2 1
1 S 2
1 n 2 1 S 2
2
21 11.30 2
25 11.16 2
1.5021
(n1 1) (n 2 1) (21 - 1) ( 25 1)
P
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-12
Pooled-Variance t Test Example:
Hypothesis Test Solution
DCOVA
Reject H0 Reject H0
H0: μ1 - μ2 = 0 i.e. (μ1 = μ2)
H1: μ1 - μ2 ≠ 0 i.e. (μ1 ≠ μ2)
a = 0.05 .025 .025
df = 21 + 25 - 2 = 44 -2.0154 0 2.0154 t
Critical Values: t = ± 2.0154
2.040
Test Statistic: Decision:
3.27 2.53
t STAT 2.040 Reject H0 at a = 0.05
1 1
1.5021 Conclusion:
21 25 There is evidence of a
difference in means.
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-13
Excel Pooled-Variance t test
Comparing NYSE & NASDAQ
DCOVA
Pooled-Variance t Test for the Difference Between Two Means
(assumes equal population variances)
Data
Hypothesized Difference
Level of Significance
0
0.05
Decision:
Reject H0 at a = 0.05
Population 1 Sample
Sample Size 21 =COUNT(DATA!$A:$A)
Sample Mean 3.27 =AVERAGE(DATA!$A:$A)
Sample Standard Deviation 1.3 =STDEV(DATA!$A:$A)
Sample Size
Sample Mean
Population 2 Sample
25 =COUNT(DATA!$B:$B)
2.53 =AVERAGE(DATA!$B:$B)
Conclusion:
Sample Standard Deviation 1.16 =STDEV(DATA!$B:$B)
There is evidence of a
Intermediate Calculations
Population 1 Sample Degrees of Freedom
Population 2 Sample Degrees of Freedom
20 =B7 - 1
24 =B11 - 1
difference in means.
Total Degrees of Freedom 44 =B16 + B17
Pooled Variance 1.502 =((B16 * B9^2) + (B17 * B13^2)) / B18
Standard Error 0.363 =SQRT(B19 * (1/B7 + 1/B11))
Difference in Sample Means 0.74 =B8 - B12
t Test Statistic 2.040 =(B21 - B4) / B20
Two-Tail Test
Lower Critical Value -2.015 =-TINV(B5, B18)
Upper Critical Value 2.015 =TINV(B5, B18)
p-value 0.047 =TDIST(ABS(B22),B18,2)
Reject the null hypothesis =IF(B27<B5,"Reject the null hypothesis",
"Do not reject the null hypothesis")
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-14
Minitab Pooled-Variance t test
Comparing NYSE & NASDAQ
DCOVA
Two-Sample T-Test and CI
X X t
1 2 a/2
1
2
p
1
S 0.74 2.0154 0.3628 (0.009, 1.471)
n1 n 2
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-16
Hypothesis tests for µ1 - µ2 with σ1
and σ2 unknown, not assumed equal
DCOVA
Population means, Assumptions:
independent
Samples are randomly and
samples
independently drawn
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-17
Hypothesis tests for µ1 - µ2 with σ1 and
σ2 unknown and not assumed equal
(continued)
DCOVA
The test statistic is:
Population means,
independent
t STAT
X 1
X 2 μ1 μ 2
samples
S12 S 22
n1 n 2
σ1 and σ2 unknown,
assumed equal tSTAT has d.f. ν =
2
S1 2 S 2 2
n n
2
1 2
2
S1 2 S22
σ1 and σ2 unknown,
not assumed equal
*
n
n1 1
n
1 2
n2 1
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-18
Related Populations
The Paired Difference Test
DCOVA
Tests Means of 2 Related Populations
Related Paired or matched samples
samples Repeated measures (before/after)
Use difference between paired values:
Di = X2i – X1i
Eliminates Variation Among Subjects
Assumptions:
Both Populations Are Normally Distributed
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-19
Related Populations
The Paired Difference Test DCOVA
(continued)
The ith paired difference is Di , where
Related Di = X1i - X2i
samples
n
The point estimate for the
paired difference
D i
population mean μD is D : D
i 1
n
n
The sample standard i
(D D ) 2
deviation is SD SD i 1
n1
n is the number of pairs in the paired sample
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-20
The Paired Difference Test:
Finding tSTAT
DCOVA
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-21
The Paired Difference Test:
Possible Hypotheses DCOVA
Paired Samples
a a a/2 a/2
where
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-23
Paired Difference Test:
Example DCOVA
Assume you send your salespeople to a “customer
service” training workshop. Has the training made a
difference in the number of complaints? You collect
the following data:
Number of Complaints: (2) - (1) Di
Salesperson Before (1) After (2) Difference, Di D = n
C.B. 6 4 - 2 = -4.2
T.F. 20 6 -14
M.H. 3 2 - 1
R.K. 0 0 0
SD
i
(D D ) 2
M.O. 4 0 - 4
n 1
-21
5.67
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-24
Paired Difference Test:
Solution DCOVA
Data
Since -2.776 < -1.66 < 2.776
Hypothesized Mean Diff. 0 we do not reject the null hypothesis.
Level of Significance 0.05
Or
Intermediate Calculations
Sample Size 5 =COUNT(I2:I6)
Dbar -4.2 =AVERAGE(I2:I6) Since p-value = 0.173 > 0.05 we
Degrees of Freedom 4 =B8 - 1 do not reject the null hypothesis.
SD 5.67 =STDEV(I2:I6)
Standard Error 2.54 =B11/SQRT(B8) Thus we conclude that there is
t-Test Statistic -1.66 =(B9 - B4)/B12
Insufficient evidence to conclude
Two-Tail Test there is a difference in the average
Lower Critical Value -2.776 =-TINV(B5,B10) number of complaints.
Upper Critical Value 2.776 =TINV(B5,B10)
p-value 0.173 =TDIST(ABS(B13),B10,2)
Do not reject the null =IF(B18<B5,"Reject the null
Hypothesis hypothesis",
"Do not reject the null hypothesis")
Data not shown is in column I
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-26
Paired t Test In Minitab Yields
The Same Conclusions
Paired T-Test and CI: After, Before DCOVA
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-27
Two Population Proportions
DCOVA
Goal: test a hypothesis or form a
confidence interval for the difference
between two population proportions,
π1 – π2
Population
proportions
X1 X 2
p
n1 n 2
where X1 and X2 are the number of items of
interest in samples 1 and 2
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-29
Two Population Proportions
(continued)
Z STAT
p1 p2 π1 π2
1 1
p (1 p )
n1 n2
X1 X 2 X1 X2
where p , p1 , p2
n1 n2 n1 n2
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-30
Hypothesis Tests for
Two Population Proportions
DCOVA
Population proportions
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-31
Hypothesis Tests for
Two Population Proportions
(continued)
Population proportions DCOVA
Lower-tail test: Upper-tail test: Two-tail test:
H0: π1 – π2 0 H0: π1 – π2 ≤ 0 H0: π1 – π2 = 0
H1: π1 – π2 < 0 H1: π1 – π2 > 0 H1: π1 – π2 ≠ 0
a a a/2 a/2
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-32
Hypothesis Test Example:
Two population Proportions
DCOVA
Is there a significant difference between the
proportion of men and the proportion of
women who will vote Yes on Proposition A?
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-33
Hypothesis Test Example:
Two population Proportions
(continued)
DCOVA
The hypothesis test is:
H0: π1 – π2 = 0 (the two proportions are equal)
H1: π1 – π2 ≠ 0 (there is a significant difference between proportions)
z STAT
p1 p2 π1 π2
1 1
p ( 1 p) -1.96 1.96
n1 n2 -2.20
.50 .70 0 2 .20
1 1 Decision: Reject H0
.582 ( 1 .582 )
72 50
Conclusion: There is
evidence of a difference in
Critical Values = ±1.96
For a = .05 proportions who will vote
yes between men and
women.
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-35
Two Proportion Test In Excel
DCOVA
Z Test for Differences in Two Proportions
Data
Hypothesized Difference 0 Since -2.20 < -1.96
Level of Significance 0.05
Group 1
Number of items of interest 36
Or
Sample Size 72
Group 2 Since p-value = 0.028 < 0.05
Number of items of interest 35
Sample Size 50
We reject the null hypothesis
Intermediate Calculations
Group 1 Proportion 0.5 =B7/B8
Group 2 Proportion 0.7 =B10/B11
Difference in Two Proportions -0.2 =B14 - B15 Decision: Reject H0
Average Proportion 0.582 =(B7 + B10)/(B8 + B11)
Z Test Statistic -2.20 =(B16-B4)/SQRT((B17*(1-B17))*(1/B8+1/B11))
Sample X N Sample p
1 36 72 0.500000
2 35 50 0.700000
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-37
Confidence Interval for
Two Population Proportions
DCOVA
p1 (1 p1 ) p 2 (1 p 2 )
p1 p 2 Za/2
n1 n2
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-38
Testing for the Ratio Of Two
Population Variances DCOVA
Hypotheses FSTAT
Tests for Two
Population
* H0: σ12 = σ22
H1: σ12 ≠ σ22 S 2
1
Variances 2
H0: σ12 ≤ σ22 S 2
H1: σ12 > σ22
F test statistic
Where:
S12 = Variance of sample 1 (the larger sample variance)
n1 = sample size of sample 1
S 22 = Variance of sample 2 (the smaller sample variance)
n2 = sample size of sample 2
n1 –1 = numerator degrees of freedom
n2 – 1 = denominator degrees of freedom
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-39
The F Distribution
DCOVA
The F critical value is found from the F table
There are two degrees of freedom required: numerator
and denominator
The larger sample variance is always the numerator
2
S
When FSTAT 1
2
df1 = n1 – 1 ; df2 = n2 – 1
S 2
In the F table,
numerator degrees of freedom determine the column
denominator degrees of freedom determine the row
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-40
Finding the Rejection Region
DCOVA
H0: σ12 = σ22 H0: σ12 ≤ σ22
H1: σ12 ≠ σ22 H1: σ12 > σ22
a/2 F a
0 0
Do not Reject H0 Do not Reject H0 F
reject H0 Fα/2 reject H0 Fα
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-41
F Test: An Example
DCOVA
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-42
F Test: Example Solution
DCOVA
Form the hypothesis test:
H 0: σ12 σ 22 (there is no difference between variances)
H 1: σ 12 σ 22 (there is a difference between variances)
Numerator d.f. = n1 – 1 = 21 –1 = 20
Denominator d.f. = n2 – 1 = 25 –1 = 24
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-43
F Test: Example Solution
DCOVA
(continued)
0 F
Do not Reject H0
reject H0
FSTAT = 1.256 is not in the rejection F0.025=2.33
region, so we do not reject H0
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-44
Two Variance F Test In Excel
DCOVA
F Test for Differences in Two Variables Conclusion:
Level of Significance
Data
0.05
There is insufficient evidence
Larger-Variance Sample of a difference in variances
Sample Size 21
Sample Variance 1.6900 =1.3^2 at a = .05 because:
Smaller-Variance Sample
Sample Size 25
Sample Variance 1.3456 =1.16^2
Intermediate Calculations
F statistic =1.256 < 2.327 Fα/2
F Test Statistic 1.256 1.255945
Population 1 Sample Degrees of Freedom 20 =B6 - 1
or
Population 2 Sample Degrees of Freedom 24 =B9 - 1
p-value = 0.589 > 0.05 = α.
Two-Tail Test
Upper Critical Value 2.327 =FINV(B4/2,B14,B15)
p-value 0.589 =2*FDIST(B13,B14,B15)
Do not reject the null hypothesis =IF(B19<B4,"Reject the null hypothesis",
"Do not reject the null hypothesis")
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-45
Two Variance F Test In Minitab
Yields The Same Conclusion
Test and CI for Two Variances
DCOVA
Null hypothesis Sigma(1) / Sigma(2) = 1
Alternative hypothesis Sigma(1) / Sigma(2) not = 1
Significance level Alpha = 0.05
Statistics
Sample N StDev Variance
1 21 1.300 1.690
2 25 1.160 1.346
CI for
Distribution CI for StDev Variance
of Data Ratio Ratio
Normal (0.735, 1.739) (0.540, 3.024)
Tests
Test
Method DF1 DF2 Statistic P-Value
F Test (normal) 20 24 1.26 0.589
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-46
Chapter Summary
Compared two independent samples
Performed pooled-variance t test for the difference in
two means
Performed separate-variance t test for difference in
two means
Formed confidence intervals for the difference
between two means
Compared two related samples (paired
samples)
Performed paired t test for the mean difference
Formed confidence intervals for the mean difference
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-47
Chapter Summary
(continued)
Copyright ©2012 Pearson Education, Inc. publishing as Prentice Hall Chap 10-48