Download Hypothesis Testing with Two Samples and more Study notes Statistics in PDF only on Docsity!
Hypothesis Testing with
Two Samples
Chapter 8
Testing the Difference
Between Means (Large
Independent Samples)
Larson & Farber, Elementary Statistics: Picturing the World, 3e 3
Two Sample Hypothesis Testing
In a two-sample hypothesis test, two parameters from two
populations are compared.
For a two-sample hypothesis test,
1. the null hypothesis H 0 is a statistical hypothesis that usually
states there is no difference between the parameters of two
populations. The null hypothesis always contains the symbol ≤,
=, or ≥.
2. the alternative hypothesis Ha is a statistical hypothesis that is
true when H 0 is false. The alternative hypothesis always
contains the symbol >, ≠, or <.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 4
Two Sample Hypothesis Testing
To write a null and alternative hypothesis for a two-sample
hypothesis test, translate the claim made about the population
parameters from a verbal statement to a mathematical statement.
H 0 : μ 1 = μ 2 Ha: μ 1 ≠ μ 2
H 0 : μ 1 ≤ μ 2
Ha: μ 1 > μ 2
H 0 : μ 1 ≥ μ 2 Ha: μ 1 < μ 2
Regardless of which hypotheses used, μ 1 = μ 2 is always
assumed to be true.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 5
Two Sample z-Test
Three conditions are necessary to perform a z-test for the
difference between two population means μ 1 and μ 2.
1. The samples must be randomly selected.
2. The samples must be independent. Two samples are
independent if the sample selected from one population is
not related to the sample selected from the second
population.
3. Each sample size must be at least 30, or, if not, each
population must have a normal distribution with a known
standard deviation.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 6
Two Sample z-Test
If these requirements are met, the sampling distribution for
(the difference of the sample means) is a normal distribution with
mean and standard error of
x 1 x 2 x 1 x 2 1 2
x 1 −x 2
and
1 2 1 2
2 2 (^2 2 1 ) 1 2
x x x x^.
− n n
−σ (^) x 1 −x 2 μ 1 −μ 2 σ (^) x 1 −x 2
Sampling distribution for x^1 −^ x 2 x 1 −x 2
Larson & Farber, Elementary Statistics: Picturing the World, 3e 10
Two Sample z-Test for the Means
Example:
A high school math teacher claims that students in her class will
score higher on the math portion of the ACT then students in a
colleague’s math class. The mean ACT math score for 49 students
in her class is 22.1 and the standard deviation is 4.8. The mean
ACT math score for 44 of the colleague’s students is 19.8 and the
standard deviation is 5.4. At α = 0.10, can the teacher’s claim be
supported?
Ha: μ 1 > μ 2 (Claim)
H 0 : μ 1 ≤ μ 2
z 0 = 1.28 Continued.
-3 -2 -1 0 1 2 3 z
α = 0.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 11
Two Sample z-Test for the Means
( ) ( ) 1 2
1 2 1 2 x x
x x μ μ z (^) σ −
Example continued:
The standardized error is
( 22.1 19.8) 0
=^ −^ −
Ha: μ 1 > μ 2 (Claim)
H 0 : μ 1 ≤ μ 2
1 2
2 2 1 2 1 2 x x
σ σ σ − (^) n n
4.8^2 5.4^2
The standardized test statistic is
z 0 = 1.
-3 -2 -1 0 1 2 3 z
Reject H 0.
There is enough evidence at the 10% level to support the teacher’s claim
that her students score better on the ACT.
§ 8.
Testing the Difference
Between Means (Small
Independent Samples)
Larson & Farber, Elementary Statistics: Picturing the World, 3e 13
Two Sample t-Test
1. The samples must be randomly selected.
2. The samples must be independent. Two samples are
independent if the sample selected from one population is
not related to the sample selected from the second
population.
3. Each population must have a normal distribution.
If samples of size less than 30 are taken from normally-distributed
populations, a t-test may be used to test the difference between the
population means μ 1 and μ 2.
Three conditions are necessary to use a t-test for small independent
samples.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 14
Two Sample t-Test
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 a sample is randomly selected from each population. Performing this test requires each population to be normally distributed, and the samples should be independent. The standardized test statistic is
If the population variances are equal, then information from the two samples is combined to calculate a pooled estimate of the standard deviation
( ) ( ) 1 2
x x
x x μ μ t σ (^) −
1 2
n s n s σ (^) n n
Continued.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 15
Two Sample t-Test
Two-Sample t-Test (Continued)
The standard error for the sampling distribution of is
and d.f.= n 1 + n 2 – 2.
If the population variances are not equal, then the standard error is
and d.f = smaller of n 1 – 1 or n 2 – 1.
(^1 21 )
ˆ^1
σ (^) x −x = σ ⋅ (^) n +n
x 1 −x 2
Variances equal
1 2
2 2 1 2 x x 1 2
s s σ − (^) n n = + (^) Variances not equal
Larson & Farber, Elementary Statistics: Picturing the World, 3e 19
Two Sample t-Test for the Means
Example:
A random sample of 17 police officers in Brownsville has a mean
annual income of $35,800 and a standard deviation of $7,800. In
Greensville, a random sample of 18 police officers has a mean
annual income of $35,100 and a standard deviation of $7,375. Test
the claim at α = 0.01 that the mean annual incomes in the two cities
are not the same. Assume the population variances are equal.
Ha: μ 1 ≠ μ 2 (Claim)
H 0 : μ 1 = μ 2
Continued.
- t 0 = –2. d.f. = n 1 + n 2 – 2 = 17 + 18 – 2 = 33
t 0 = 2. -3 -2 -1 0 1 2 3 t
- 005 2
(^1) α = 0. 005 2
(^1) α=
Larson & Farber, Elementary Statistics: Picturing the World, 3e 20
Two Sample t-Test for the Means
Example continued:
The standardized error is
(^1 21 ) ˆ^1 σ (^) x −x = σ (^) n +n
( 17 1 7800) 2 ( 18 1 7375)^2 1
= −^ +^ − ⋅ +
1 2 1 2
n s n s n n n n
= −^ +^ − ⋅ +
Ha: μ 1 ≠ μ 2 (Claim)
H 0 : μ 1 = μ 2
-3 -2 -1 0 1 2 3 t t 0 = 2.
≈2564.92 Continued.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 21
Two Sample t-Test for the Means
( ) ( ) 1 2
1 2 1 2 x x
x x μ μ t σ (^) −
Example continued:
The standardized test statistic is
Fail to reject H 0.
There is not enough evidence at the 1% level to support the claim
that the mean annual incomes differ.
Ha: μ 1 ≠ μ 2 (Claim)
H 0 : μ 1 = μ 2
-3 -2 -1 0 1 2 3 t t 0 = 2.
( 35800 35100 ) 0
§ 8.
Testing the Difference
Between Means
(Dependent Samples)
Larson & Farber, Elementary Statistics: Picturing the World, 3e 23
Two samples are independent if the sample selected from one
population is not related to the sample selected from the second
population. Two samples are dependent if each member of one
sample corresponds to a member of the other sample. Dependent
samples are also called paired samples or matched samples.
Independent and Dependent Samples
Independent Samples Dependent Samples
Larson & Farber, Elementary Statistics: Picturing the World, 3e 24
Example:
Classify each pair of samples as independent or dependent.
Independent and Dependent Samples
Sample 1: The weight of 24 students in a first-grade class
Sample 2: The height of the same 24 students
These samples are dependent because the weight and height can
be paired with respect to each student.
Sample 1: The average price of 15 new trucks
Sample 2: The average price of 20 used sedans
These samples are independent because it is not possible to pair
the new trucks with the used sedans. The data represents prices
for different vehicles.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 28
t-Test for the Difference Between Means
t-Test for the Difference Between Means
A t-test can be used to test the difference of two population means when a sample is randomly selected from each population. The requirements for performing the test are that each population must be normal and each member of the first sample must be paired with a member of the second sample. The test statistic is
and the standardized test statistic is
The degrees of freedom are d.f. = n – 1.
d. d
t d^ μ s n
=^ −
d d n
=^ ∑
Larson & Farber, Elementary Statistics: Picturing the World, 3e 29
t-Test for the Difference Between Means
- State the claim mathematically. Identify the null and alternative hypotheses.
- Specify the level of significance.
- Identify the degrees of freedom and sketch the sampling distribution.
- Determine the critical value(s).
Continued.
Using the t-Test for the Difference Between Means
(Dependent Samples)
In Words In Symbols
State H 0 and Ha.
Identify α.
Use Table 5 in Appendix B.
d.f. = n – 1
Larson & Farber, Elementary Statistics: Picturing the World, 3e 30
t-Test for the Difference Between Means
In Words In Symbols
- Determine the rejection region(s).
- Calculate and Use a table.
- Find the standardized test statistic.
Using a Two-Sample t-Test for the Difference Between Means
(Small Independent Samples)
d d n
d sd. =^ ∑
( 2 ) ( )^2
d ( 1) s n^ d^ d n n
= ∑^ − ∑
d d
d μ t s n
Larson & Farber, Elementary Statistics: Picturing the World, 3e 31
t-Test for the Difference Between Means
In Words In Symbols
If t is in the rejection region, reject H 0. Otherwise, fail to reject H 0.
- Make a decision to reject or fail to reject the null hypothesis.
- Interpret the decision in the context of the original claim.
Using a Two-Sample t-Test for the Difference Between Means
(Small Independent Samples)
Larson & Farber, Elementary Statistics: Picturing the World, 3e 32
t-Test for the Difference Between Means
Example:
A reading center claims that students will perform better on a
standardized reading test after going through the reading course
offered by their center. The table shows the reading scores of 6
students before and after the course. At α = 0.05, is there enough
evidence to conclude that the students’ scores after the course are
better than the scores before the course?
Continued.
Score (after) 88 85 89 86 92 89
Score (before) 85 96 70 76 81 78
Student 1 2 3 4 5 6
Ha: μd > 0 (Claim)
H 0 : μd ≤ 0
Larson & Farber, Elementary Statistics: Picturing the World, 3e 33
t-Test for the Difference Between Means
Score (after) 88 85 89 86 92 89 d − 3 11 − 19 − 10 − 11 − 11 d 2 9 121361100121121
Score (before) 85 96 70 76 81 78
Student 1 2 3 4 5 6
Example continued:
Ha: μd > 0 (Claim)
H 0 : μd ≤ 0
Continued.
d.f. = 6 – 1 = 5
t 0 = 2.
-3 -2 -1 0 1 2 3 t
α = 0.
d d n
= ∑^43 7.
( 2 ) ( )^2 = − ≈ 104.967≈10.
d ( 1) s n^ d^ d n n
= ∑^ − ∑
∑d = − 43 ∑d 2 = 833
d = (score before) – (score after)
Larson & Farber, Elementary Statistics: Picturing the World, 3e 37
Two Sample z-Test for Proportions
If these conditions are met, then the sampling distribution for
is a normal distribution with meanpˆ 1 −pˆ 2
μ pˆ 1 − pˆ 2 = p 1 −p 2
and standard error
ˆ 1 ˆ (^2 1 )
, wh er e 1.
p p 2
σ pq q p
− n n
= ^ + = −
A weighted estimate of p 1 and p 2 can be found by using
1 2 1 1 1 2 2 2 1 2
, wh er e ˆ a n d ˆ.
x x
p x n p x n p
n n
Larson & Farber, Elementary Statistics: Picturing the World, 3e 38
Two Sample z-Test for Proportions
Two Sample z-Test for the Difference Between Proportions
A two sample z-test is used to test the difference between two population proportions p 1 and p 2 when a sample is randomly selected from each population. The test statistic is
and the standardized test statistic is
where
1 2 1 2
1 2
p p p p z pq (^) n n
pˆ 1 −pˆ 1
1 2 1 2
p x^ x a n d q 1 p. n n
, , , a n d m u st b
Not e:
e a t lea st 5.
n p n q n p n q
Larson & Farber, Elementary Statistics: Picturing the World, 3e 39
Two Sample z-Test for Proportions
- State the claim. Identify the null and alternative hypotheses.
- Specify the level of significance.
- Determine the critical value(s).
- Determine the rejection region(s).
- Find the weighted estimate of p 1 and p 2. Continued.
Using a Two-Sample z-Test for the Difference Between
Proportions
In Words In Symbols
State H 0 and Ha.
Identify α.
Use Table 4 in Appendix B.
1 2 1 2
x x
p
n n
Larson & Farber, Elementary Statistics: Picturing the World, 3e 40
Two Sample z-Test for Proportions
In Words In Symbols
- Find the standardized test statistic.
- Make a decision to reject or fail to reject the null hypothesis.
- Interpret the decision in the context of the original claim.
Using a Two-Sample z-Test for the Difference Between
Proportions
1 2 1 2
1 2
z^ p^ p^ p^ p pq n n
= −^ −^ −
If z is in the rejection region, reject H 0. Otherwise, fail to reject H 0.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 41
Two Sample z-Test for Proportions
Example:
A recent survey stated that male college students smoke less than
female college students. In a survey of 1245 male students, 361
said they smoke at least one pack of cigarettes a day. In a survey of
1065 female students, 341 said they smoke at least one pack a day.
At α = 0.01, can you support the claim that the proportion of male
college students who smoke at least one pack of cigarettes a day is
lower then the proportion of female college students who smoke at
least one pack a day?
Ha: p 1 < p 2 (Claim)
H 0 : p 1 ≥ p 2
−z 0 = −2.33 Continued.
-3 -2 -1 0 1 2 3 z
α = 0.
Larson & Farber, Elementary Statistics: Picturing the World, 3e 42
Two Sample z-Test for Proportions
Example continued:
Ha: p 1 < p 2 (Claim)
H 0 : p 1 ≥ p 2
Continued.
−z 0 = −2.
-3 -2 -1 0 1 2 3 z
1 2 1 2
x x
p
n n
1 1 2 2 1 2
n p ˆ n pˆ
n n
q = 1 − p= 1 − 0.304 =0.
Because 1245(0.304), 1245(0.696), 1065(0.304), and 1065(0.696) are all at least 5, we can use a two-sample z-test.