Two-Sample Hypothesis Testing Guide
Two-Sample Hypothesis Testing Guide
Hypothesis Testing
with Two Samples
1
Chapter Outline
. 2
Section 8.1
Testing the Difference Between Means (Independent Samples,
s1 and s2 Known)
. 3
Section 8.1 Objectives
. 4
Two Sample Hypothesis Test
• Compares two parameters from two populations.
• Sampling methods:
• Independent Samples
• The sample selected from one population is not related to the sample selected from the
second population.
• Dependent Samples (paired or matched samples)
• Each member of one sample corresponds to a member of the other sample.
. 5
Independent and Dependent Samples
. 6
Example: Independent and Dependent
Samples
Classify each pair of samples as independent or dependent.
1. Sample 1: Triglyceride levels of 70 patients
Sample 2: Triglyceride levels of the same 70 patients after using a
triglyceride-lowering drug for 6 months.
Solution:
These samples are dependent. Because the triglyceride
levels of the same patients are taken, the samples are
related. The samples can be paired with respect to each
patient.
. 7
Example: Independent and Dependent
Samples
Classify each pair of samples as independent or dependent.
2. Sample 1: Scores for 38 adult males on a psychological screening test for
attention-deficit/hyperactivity disorder
Sample 2: Scores for 50 adult females on a psychological screening test for
attention-deficit/hyperactivity disorder
Solution:
These samples are independent. It is not possible to form
a pairing between the members of samples, the sample
sizes are different, and the data represent scores for
different individuals.
. 8
Two Sample Hypothesis Test with
Independent Samples
1. Null hypothesis H0
• A statistical hypothesis that usually states there is no difference between
the parameters of two populations.
• Always contains the symbol £, =, or ³.
2. Alternative hypothesis Ha
• A statistical hypothesis that is true when H0 is false.
• Always contains the symbol >, ¹, or <.
. 9
Two Sample Hypothesis Test with
Independent Samples
H0: μ1 = μ2 H0: μ1 ≤ μ2 H0: μ1 ≥ μ2
Ha: μ1 ≠ μ2 Ha: μ1 > μ2 Ha: μ1 < μ2
. 10
Two Sample z-Test for the Difference
Between Means
To perform a z-test for the difference between two population means μ1
and μ2 when the samples are independent, the following conditions are
necessary.
1. The population standard deviations are known.
2. The samples are randomly selected.
3. The samples are independent.
4. The populations are normally distributed or each sample size is at
least 30.
. 11
Two Sample z-Test for the Difference Between
Means
When these conditions are met, the sampling
distribution for x! 1 − x! 2, the difference of the sample
means, is a normal distribution with mean and standard
error as shown.
. 12
Two Sample z-Test for the Difference
Between Means
A two-sample z-test can be used to test the difference between two
population means µ1 and µ2 when these conditions are met.
1. Both s1 and s2 are known.
2. The samples are random.
3. The samples are independent.
4. The populations are normally distributed or both
n1 ³ 30 and n2 ≥ 30.
The test statistic is x!1 – x!2. The standardized test statistic is
z=
( x1 - x2) - (µ1 - µ2)
where s x - x =
s 12 s 22
+
s x -x
1 2
1 2
n1 n2
. 13
Using a Two-Sample z-Test for the Difference Between
Means (Independent Samples, s1 and s2 Known)
In Words In Symbols
1. Verify that σ1 and σ2 are known,
the samples are random and
independent, and either the
populations are normally
distributed or both n1 ³ 30 and
n2 ³ 30 .
2. State the claim mathematically State H0 and Ha.
and verbally. Identify the null
and alternative hypotheses.
. 14
Using a Two-Sample z-Test for the Difference Between
Means (Independent Samples, s1 and s2 Known)
In Words In Symbols
distribution.
. 15
Using a Two-Sample z-Test for the Difference Between
Means (Independent Samples, s1 and s2 Known)
In Words In Symbols
. 16
Example: Two-Sample z-Test for the Difference
Between Means
A credit card watchdog group claims that there is a difference in the mean
credit card debts of households in California and Florida. The results of a
random survey of 250 households from each state are shown at the left. The
two samples are independent. Assume that σ1 = $960 for California and σ2 =
$845 for Florida. Do the results support the group’s claim? Use α = 0.05.
(Adapted from Federal Reserve Bank of New York)
. 17
18
19
Solution: Two-Sample z-Test for the
Difference
Solution:
Between Means
s1 and s2 are known, the samples are random and independent, and both
n1 and n2 are at least 30. So, you can use the z-test. The claim is “there is a
difference in the mean credit card debts of people in California and
Florida.” So, the null and alternative hypotheses are
H0: µ1 = µ2 and Ha: µ1 ¹ µ2. (Claim)
Because the test is a two-tailed test and the level of significance is a =
0.05, the critical values are −z0 = −1.96 and z0 = 1.96. The rejection
regions are z < −1.96 and z > 1.96.
. 20
Solution: Two-Sample z-Test for the
Difference Between Means
The standardized test statistic is
(x
"1 # x
"2) –(µ1 − µ2)
z=
s 12 + s 22
n1 n2
(3060 – 2910) − 0
= Assume µ1 = µ2, so µ1 − µ2 = 0.
9602 + 8452
250 250
≈1.85.
. 21
Solution: Two-Sample z-Test for the
Difference Between Means
The figure shows the location of the rejection regions and the
standardized test statistic z. Because z is not in the rejection region,
you fail to reject the null hypothesis.
. 23
Solution: Using Technology to
Perform a Two-Sample z-Test
Solution:
s1 and s2 are known, the samples are random and independent, and
the populations are normally distributed. So, you can use the z-test.
The claim is “the average daily cost of meals and lodging for
vacationing in Texas is less than the average daily cost in Virginia.” So,
the null and alternative hypotheses are H0: µ1 ³ µ2 and Ha: µ1 < µ2
(claim).
The standardized test statistic is
(x
"1 # x
"2) –(µ1 − µ2)
z=
s 12 + s 22
n1 n2
. 24
Solution: Using Technology to
Perform a Two-Sample z-Test
Because the test is a left-tailed test and a = 0.01, the rejection region is z
< −2.33. The standardized test statistic z ≈ −0.87 is not in the rejection
region, so you fail to reject the null hypothesis.
. 25
Section 8.2
Testing the Difference Between Means (Independent Samples,
s1 and s2 Unknown)
. 26
Section 8.2 Objectives
. 27
Two Sample t-Test for the Difference Between
Means
A two-sample t-test is used to test the difference between
two population means μ1 and μ2 when
1. σ2 and σ2 are unknown,
2. the samples are random,
3. the samples are independent, and
4. the populations are normally distributed or both n1 ≥
30 and n2 ≥ 30.
. 28
Two Sample t-Test for the Difference Between
Means
• The test statistic is x1 − x2
• The standardized test statistic is s
. 29
Two Sample t-Test for the Difference Between
Means
• Variances are equal: If the population variances are equal,
then information from the two samples is combined to
calculate a pooled estimate of the standard deviation s!.
sˆ =
(1 )1 (2 ) 2
n - 1 s 2
+ n - 1 s 2
n1 + n2 - 2
• The standard error for the sampling distribution of
x1 - x2 is 1 1
sx!1 " x!2 = s
! " n +n
1 2
• d.f.= n1 + n2 – 2
. 30
Two Sample t-Test for the Difference Between
Means
• Variances are not equal: If the population variances are not equal, then
the standard error is
2 2
s1 s2
sx −x = +
1 2
n1 n2
• d.f = smaller of n1 – 1 or n2 – 1
. 31
Two-Sample Tests for Independent Samples
. 32
Two-Sample t-Test for the Difference Between
Means (Independent Samples σ2 and σ2
Unknown )
In Words In Symbols
1. Verify that s1 and s2 are unknown,
the samples are random and
independent, and either the
populations are normally distributed
or both n1 ³ 30 and n2 ³ 30 .
2. State the claim mathematically and State H0 and Ha.
verbally. Identify the null and
alternative hypotheses.
3. Specify the level of significance. Identify a.
. 33
Two-Sample t-Test for the Difference Between
Means (Independent Samples σ2 and σ2
Unknown )
In Words In Symbols
d.f. = n1+ n2 – 2 or
4. Determine the degrees of
d.f. = smaller of
freedom.
n1 – 1 or n2 – 1.
. 34
Two-Sample t-Test for the Difference Between
Means (Independent Samples σ2 and σ2
Unknown )
In Words In Symbols
7. Find the standardized test
statistic and sketch the sampling t=
( x1 - x2) - (µ1 - µ2)
distribution. sx - x
1 2
. 35
Example: Two-Sample t-Test for the Difference
Between Means
The results of a state mathematics test for random samples
of students taught by two different teachers at the same
school are shown below. Can you conclude that there is a
difference in the mean mathematics test scores for the
students of the two teachers? Use α = 0.10. Assume the
populations are normally distributed and the population
variances are not equal.
Teacher 1 Teacher 2
x1 = 473 x2 = 459
s1 = 39.7 s2 = 24.5
n1 = 8 n2 = 18
. 36
Solution: Two-Sample t-Test for the Difference
Between Means
Solution:
Note that s1 and s2 are unknown, the samples are random and
independent, and the populations are normally distributed. So, you
can use the t-test. The claim is “there is a difference in the mean
mathematics test scores for the students of the two teachers.” So, the
null and alternative hypotheses are
H0: µ1 = µ2 and Ha: µ1 ¹ µ2. (Claim)
. 37
Solution: Two-Sample t-Test for the Difference
Between Means
Because the population variances are not equal and the smaller
sample size is 8, use d.f. = 8 − 1 = 7. The test is a two-tailed test with
d.f. = 7 and a = 0.10, so the critical values are −t0 = −1.895 and t0 =
1.895. The rejection regions are t < −1.895 and t > 1.895.
s12 s22
sx −x = +
1 2
n1 n2
. 38
39
Solution: Two-Sample t-Test for the Difference
Between Means
≈0.922.
. 40
Solution: Two-Sample t-Test for the Difference
Between Means
The figure shows the location of the rejection regions and the standardized
test statistic t. Because t is not in the rejection region, you fail to reject the
null hypothesis.
. 42
Solution: Two-Sample t-Test for the Difference
Between Means
Solution:
s1 and s2 are unknown, the samples are random and independent,
and both n1 and n2 are at least 30. So, you can use the t-test. The claim
is “the mean driving cost per mile of the manufacturer’s sedans is less
than that of its leading competitor.” So, the null and alternative
hypotheses are
H0: µ1 ³ µ2 and Ha: µ1 < µ2. (Claim)
. 43
Solution: Two-Sample t-Test for the Difference
Between Means
. 44
45
Solution: Two-Sample t-Test for the Difference
Between Means
(n1"1)s12 + (n2−1)s22 1 1
sx!1−x!2 = % +
n1+ n2−2 n1 n2
(30"1)(0.05)2 + (32−1)(0.07)2 1 1
sx!1−x!2 = % +
30 + 32−2 30 32
≈ 0.0155416
. 46
Solution: Two-Sample t-Test for the Difference
Between Means
The standardized test statistic is
(x!1 " x!2) " (µ1 " µ2)
t= Use the t-test (variances are equal).
sx! 1"x! 2
(0.48 − 0.51) − 0
= Assume µ1 = µ2, so µ1 − µ2 = 0.
0.0155416
≈ −1.930.
. 47
Solution: Two-Sample t-Test for the Difference
Between Means
The figure shows the location of the rejection region and the standardized
test statistic t. Because t is in the rejection region, you reject the null
hypothesis.
. 48
Section 8.3
Testing the Difference Between Means (Dependent Samples)
. 49
Section 8.3 Objectives
. 50
t-Test for the Difference Between Means
. 51
t-Test for the Difference Between Means
Three conditions are required to conduct the test.
[Link] samples must be randomly selected.
[Link] samples must be dependent (paired).
[Link] populations must be normally distributed or the number
n of pairs of data is at least 30.
If these conditions are met, then the sampling distribution for d! ,
the mean of the differences of the paired data entries in the
dependent samples, is approximated
by a t-distribution with n – 1
degrees of freedom, where n
is the number of data pairs.
. 52
Symbols used for the t-Test for μd
Symbol Description
n The number of pairs of data
. 53
Symbols used for the t-Test for μd
Symbol Description
d The mean of the differences between the paired
data entries in the dependent samples
åd
d=
n
sd The standard deviation of the differences between
the paired data entries in the dependent samples
∑ (d ! 2
– d)
sd = n–1
. 54
t-Test for the Difference Between Means
A t-test can be used to test the difference of two population means when
these conditions are met.
. 55
t-Test for the Difference Between Means
d - µd
t=
sd n
. 56
t-Test for the Difference Between Means
(Dependent Samples)
In Words In Symbols
1. Verify that the samples are
random and dependent, and
either the populations are
normally distributed or n ³ 30 .
2. State the claim mathematically State H0 and Ha.
and verbally. Identify the null
and alternative hypotheses.
3. Specify the level of significance. Identify a.
. 57
t-Test for the Difference Between Means
(Dependent Samples)
In Words In Symbols
4. Identify the degrees of freedom. d.f. = n – 1
5. Determine the critical value(s). Use T Statistics Table
6. Determine the rejection
region(s).
7. Calculate d and sd. d = åd
n
∑ (d ! 2
– d)
sd = n–1
. 58
t-Test for the Difference Between Means
(Dependent Samples)
In Words In Symbols
8. Find the standardized test d - µd
statistic and sketch the t=
sd n
sampling distribution.
9. Make a decision to reject or If t is in the rejection
fail to reject the null region, then reject H0 .
hypothesis. Otherwise, fail to reject H0 .
10. Interpret the decision in the
context of the original claim.
. 59
Example: t-Test for the Difference
Between Means
A shoe manufacturer claims that the athletes can increase
their vertical jump heights using the manufacturer’s training
shoes. The vertical jump heights of eight randomly selected
athletes are measured. After the athletes have used the
training shoes for 8 months, their vertical jump heights are
measured again. The vertical jump heights (in inches) for
each athlete are shown in the table. At α = 0.10, is there
enough evidence to support the manufacturer’s claim?
Assuming the vertical jump heights are normally distributed
(Adapted from Coaches Sports Publishing)
Athletes 1 2 3 4 5 6 7 8
Height (old) 24 22 25 28 35 32 30 27
Height (new) 26 25 25 29 33 34 35 30
. 60
Solution: Two-Sample t-Test for the Difference
Between Means
Solution:
Because the samples are random and dependent, and the
populations are normally distributed, you can use the t-test.
The claim is that “athletes can increase their vertical jump
heights.” In other words, the manufacturer claims that an
athlete’s vertical jump height before using the shoes will be
less than the athlete’s vertical jump height after using the
shoes. Each difference is given by
d = (jump height before shoes) – (jump height after shoes).
The null and alternative hypotheses are
H0: µd ³ 0 and Ha: µd < 0. (Claim)
. 61
Solution: Two-Sample t-Test for the Difference
Between Means
. 62
63
Solution: Two-Sample t-Test for the
Difference Between Means
Before After d d2
24 26 –2 4 d = å d = -14 = -1.75
n 8
22 25 –3 9
25 25 0 0 2 é(S d ) 2
ù
Sd - ê ú
28 29 –1 1 ë n û
sd =
35 33 2 4 n -1
2
32 34 –2 4 (-14)
56 -
30 35 –5 25 = 8
8 -1
27 30 –3 9
» 2.1213
Σ = –14 Σ = 56
. 64
Solution: Two-Sample t-Test for the
Difference Between Means
The standardized test statistic is
d - µd -1.75 - 0
t= » » -2.333
sd n 2.1213 8
. 65
Solution: Two-Sample t-Test for the
Difference Between Means
. 66
Example: t-Test for the Difference
Between Means
The campaign staff for a state legislator wants to determine
whether the legislator’s performance rating (0 –100) has changed
from last year to this year. The table below shows the legislator’s
performance ratings from the same 16 randomly selected voters
for last year and this year. At a = 0.01, is there enough evidence to
conclude that the legislator’s performance rating has changed?
Assume the performance ratings are normally distributed.
. 67
Solution: t-Test for the Difference
Between Means
Solution:
Because the samples are random and dependent, and the populations
are normally distributed, you can use the t-test. If there is a change in
the legislator’s rating, then there will be a difference between last
year’s ratings and this year’s ratings. Because the legislator wants to
determine whether there is a difference, the null and alternative
hypotheses are
H0: µd = 0 and Ha: µd ¹ 0. (Claim)
. 68
Solution: t-Test for the Difference
Between Means
Because the test is a two-tailed test, a = 0.01, and d.f. = 16 − 1 = 15,
the critical values are −t0 = −2.947 and t0 = 2.947. The rejection
regions are t < −2.947 and
t > 2.947.
. 69
Solution: t-Test for the Difference
Between Means
!d = ∑ d = 53 = 3.3125
n 16
∑ d2
(
− n ∑ d)2
sd =
n−1
1581− 532
= 16 ≈ 9.6797
16 − 1
. 70
Solution: t-Test for the Difference
Between Means
The standardized test statistic is
d! − µd
t= Use the t-test.
sd / n
3.3125 − 0
= Assume µd = 0.
9.6797/ 16
≈1.369.
. 71
Solution: t-Test for the Difference
Between Means
The figure shows the location of the rejection region and the standardized
test statistic t. Because t is not in the rejection region, you fail to reject the
null hypothesis.
. 73
Section 8.4 Objectives
. 74
Two-Sample z-Test for Proportions
. 75
Two-Sample z-Test for the Difference Between
Proportions
• If these conditions are met, then the sampling distribution for ,
is a normal distribution
pˆ1 - pˆ 2
• Mean: µ pˆ - pˆ = p1 - p2
1 2
• Standard error: s pˆ - pˆ = pq æç 1 + 1 ö÷
1 2
è n1 n2 ø
. 76
Two-Sample z-Test for the Difference Between
Proportions
. 79
Two-Sample z-Test for the Difference
Between Proportions
In Words In Symbols
8. Make a decision to reject or If z is in the
fail to reject the null rejection region,
hypothesis. reject H0.
Otherwise, fail to
9. Interpret the decision in the reject H0.
context of the original claim.
. 80
Example: Two-Sample z-Test for the Difference
Between Proportions
A study of 200 randomly selected occupants in passenger cars and 250
randomly selected occupants in pickup trucks shows that 91.0% of
occupants in passenger cars and 83.2% of occupants in pickup trucks wear
seat belts. At 𝛼 = 0.10, can you reject the claim that the proportion of
occupants who wear seat belts is the same for passenger cars
and pickup trucks? (Adapted from National Highway Traffic Safety
Administration)
. 81
Solution: Two-Sample z-Test for the
Difference Between Proportions
Solution:
The samples are random and independent. Also, the weighted
estimate of p1 and p2 is
x +x 182 + 208
p! = 1 2 = ≈ 0.8667
n1 + n2 200 + 250
. 82
Solution: Two-Sample z-Test for the Difference
Between Proportions
The claim is “the proportion of occupants who wear seat belts is the
same for passenger cars and pickup trucks.” So, the null and alternative
hypotheses are
H0: p1 = p2 (Claim) and Ha: p1 ¹ p2.
83
Solution: Two-Sample z-Test for the Difference
Between Proportions
The standardized test statistic is
(p$ 1 – p$ 2) – (p1 – p2) (0.910 – 0.832) – 0
z= ≈ ≈ 2.42
p" q" n1 % n1 (0.8667)(0.1333) 1 % 1
1 2 200 250
. 84
Solution: Two-Sample z-Test for the Difference
Between Proportions
The figure below shows the location of the rejection regions and the
standardized test statistic z. Because z is in the rejection region, you
reject the null hypothesis.
. 86
Solution: Two-Sample z-Test for the Difference
Between Proportions
Solution:
The samples are random and independent. Also, the weighted
estimate of p1 and p2 is
x +x 301 + 357
p! = 1 2 = ≈ 0.0731
n1 + n2 4700 + 4300
. 87
Solution: Two-Sample z-Test for the Difference
Between Proportions
The claim is “the death rate due to heart disease is lower for those
who took the medication than for those who took the placebo.” So, the
null and alternative hypotheses are
H0: p1 ≥ p2 and Ha: p1 < p2 (Claim).
Because the test is a left-tailed and the level of significance is a = 0.01,
the critical value is
−z0 = −2.33. The rejection region is z < −2.33.
88
89
90
Solution: Two-Sample z-Test for the Difference
Between Proportions
The standardized test statistic is
. 91
Solution: Two-Sample z-Test for the Difference
Between Proportions
The figure below shows the location of the rejection region and the
standardized test statistic z. Because z is in the rejection region, you
reject the null hypothesis.