P8130: Biostatistical Methods I
Methods of Inference: Two-Sample Proportions
Instructor: Vahe Khachadourian, MD, MPH, PhD
Methods of Inference: One Sample Mean
This module focuses on inferential methods concerning two-sample
proportions.
You will learn how to:
• Construct a confidence interval to estimate the true difference between
population proportions.
• Conduct a hypothesis test using the normal approximation to compare
two population proportions.
Two-Sample Binomial Test for Proportions
Setting: Suppose you have two populations and two independent random
samples 𝑛! and 𝑛" are obtained from these two populations.
• Dichotomous (binary) responses are recorded from each of the two samples
with the following proportions:
• 𝑝! representing the proportion/probability of interest in sample/group 1
• 𝑝" representing the proportion/probability of interest in sample/group 2
• Assuming that the responses from each group follow a binomial distribution,
we want to compare the two probabilities: 𝑝! and 𝑝" .
Two-Sample Binomial Test for Proportions
• Data can be classified into two mutually exclusive categories.
• Let sample 1 have an estimated proportion 𝑝 !!~𝑁(𝑝!, 𝑝!(1 − 𝑝!)/𝑛!)
• Let sample 2 have an estimated proportion 𝑝 !"~𝑁(𝑝", 𝑝"(1 − 𝑝")/𝑛")
Assuming independence of the random samples and that Normal Theory holds,
it follows that:
#! !$#! #" (!$#" )
𝑝
!! − 𝑝
!"~𝑁(𝑝! − 𝑝", %!
+ %"
).
Two-Sample Binomial Test for Proportions
Suppose we test 𝐻(: 𝑝! = 𝑝" = 𝑝 vs 𝐻!: 𝑝! ≠ 𝑝".
If the null hypothesis is true:
1 1
𝑝
!! − 𝑝
!"~𝑁 0, 𝑝(1 − 𝑝) +
𝑛! 𝑛"
𝑝 and 𝑞 = 1 − 𝑝 are unknown, but can be estimated as:
)! *%" #
%! # )"
5𝑝 = , the weighted average of the two sample proportions (*).
%! *%"
It we use this weighted average to estimate the common population proportion, then
under the null:
𝑝
!! − 𝑝
!"
𝑧= ~𝑁 0,1 .
1 1
𝑝̂ 𝑞8 𝑛 + 𝑛
! "
Two-Sample Binomial Test for Proportions
Tests for Two-Population Proportions, Normal Theory Methods:
𝐻# : 𝑝! = 𝑝" vs 𝐻! : 𝑝! ≠ 𝑝"
The test statistic with continuity correction is given by:
! !
#! %$
$ #" % & #! &*" $
*! $ #"
"#! "#"
𝑧= , where 𝑝̂ =
*! &*"
( !&!
$' ) #! #"
Reject 𝐻# : if 𝑧 > 𝑧!$%/"
Fail to reject 𝐻# : if |𝑧| ≤ 𝑧!$%/"
Confidence Intervals for the Difference in Two Population Proportions
Two-sided 100 1 − 𝛼 % confidence interval for the difference between two population
proportions is given by:
)! (!$)
# #! ) )" (!$)
# #" ) )! (!$)
# #! ) )" (!$)
# #" )
&!− 𝑝
(𝑝 )" − 𝑧!$+/" + , )
𝑝! − 𝑝
)" + 𝑧!$+/" + )
%! %" %! %"
Interpretation of a 100 1 − 𝛼 % confidence interval:
We are 100 1 − 𝛼 % confident that the true difference between the population
proportions lies between the lower limit of the CI and the upper limit of the CI.
Two-Sample Test for Binomial Proportions
Example: A total of 400 NYC households were randomly selected from two communities
and one respondent from each household was asked if he/she was bothered by the air
pollution. Use the table below to perform a hypothesis test for comparing the
proportions of respondents that were bothered by pollution in the two communities.
Type I=0.05.
Response to Air Pollution
Yes No Total
Community 1 43 157 200
Community 2 81 119 200
Total 124 276 400
Two-Sample Test for Binomial Proportions
Example Air Pollution:
Two-Sample Test for Binomial Proportions
Step 1: Extract the data info.
Community 1: 𝑛! = 200, 𝑝 )! = 43/200 = 0.215
Community 2: 𝑛" = 200, 𝑝 )" = 81/200 = 0.405
#! and 𝑝
𝑝 #" represent the sample proportions of respondents that were bothered by pollution
Step 2: Check normal approximation using (one) rule of thumb :
200 0 0.215 0 1 − 0.215 ≥ 5 and 200 0 0.405 0 1 − 0.405 ≥ 5
Step 3: Set up the hypotheses:
𝐻(: 𝑝! = 𝑝" vs 𝐻!: 𝑝! ≠ 𝑝"
Two-Sample Test for Binomial Proportions
Step 4: Calculate the test-statistic
! !
(."!.$(./(. $ *
"#"$$ "#"$$ ("((1(."!.)*("((1(./(.) !"/
𝑧= , where 𝑝̂ = = = 0.31
! ! /(( /((
(.0!(!$(.0!) *
"$$ "$$
1 1
0.215 − 0.405 − +
𝑧= 2 0 200 2 0 200 = 4.0
0.046
Step 5: At 0.05 significance level, z-stat > 𝑧!$+/"=1.96; thus we reject the null and
conclude that there is a significant difference between the proportions of respondents
bothered by pollution in the two communities.
Assuming that these communities were selected from the NY Metro area and Queens.
What can we conclude about the air pollution opinion over the entire NY State?