# Testing difference in proportions with bootstrap

Summary: I want to perform a bootstrap test on the difference of proportions. I think this is equivalent to testing the difference between means using bootstrap, but I wanted to clarify some details.

Say I am testing the proportion of men and women who smoke in some population. So I take a simple random sample of people, which contains an uneven number of men and women. If someone smokes, we will mark them as a 1 with an indicator function. If someone does not smoke, they are marked with a zero. Say there are 40 men and 35 women. First, I calculate the total proportion of smokers from the sample, say $\hat{p_T} = \frac{1}{n}\sum_i^n x_i$, where $x_i=1$ indicates a smoker. Then I calculate the proportion of men and women who smoke in the sample, separately. Say $\hat{p_M}$ and $\hat{p_W}$. Put the null hypothesis to be that there is no difference in proportion of men and women who smoke. That is,

$H_0: p_M - p_W = 0$

$H_A: p_M - p_W \neq 0$

Now to bootstrap, I have to generate replicates under the null hypothesis. What's the best way to do this? My idea is to simply resample (with replacement) from the pooled data, calculate B bootstrap proportions, say $p^*_b, b=1,...,B$ and compare the number of as extreme or more extreme values to the observed difference of proportions, over B.

Or, should I used the observed pooled proportion to shift the male and female data, as done in Efron's book, by subtracting the observed proportion from the corresponding data set, and then adding the pooled proportion. This seems "wrong" in that we are looking at Bernoulli trials, not a true continuous distribution. I think the former method makes more sense, but I am not sure how things change in this case - a proportion is just a special case of the sample mean. By shift the data, I mean this

Say $x_i$ are from the male data. Then we shift by computing

$x_i - \hat{p_M} + \hat{p_T}$, for every $i$.

Likewise for female data. Then sample from each distribution, compute a proportion, and take the difference. Repeat B times.