9.3 Two-Groups: Proportion
The hypothesis test for comparing the proportion between two groups is written as follows:
H0:ˆp1−ˆp2=0Ha:ˆp1−ˆp2≠0
We first need to calculate the pooled estimate, i.e., the total number of success over the total number of observations. You can think of this as a weighted average. Let this weighted average be ˆp∗.:
ˆp∗=p1+p2n1+n2
Then, the standard error can be calculated as follows:
S.E.=√ˆp∗⋅(1−ˆp∗)⋅(1n1+1n2)
The resulting test statistic is written as
z=ˆp1−ˆp2S.E.
Consider the hypothesis about the proportion of gun owners differentiated by male vs. female. The data is in gssgun
. A summary of the data is in the following table:
owngun | male | female |
---|---|---|
yes | 232 | 208 |
no | 335 | 501 |
The pooled proportion is calculated as follows: ˆp∗=232+208440+836=0.345 Given those numbers, the standard error is calculated as: S.E.=√0.345⋅(1−0.345)⋅(1440+1836)=0.028 The test statistic is: z=0.41−0.290.028=4.286 Thus, we reject the hypothesis that the proportion of gun owners among males and females is the same.