Suppose you have two coins 1 and 2 with unknown probabilities $p_1$ and $p_2$ of coming up heads. You then flip coin 1 $n_1$ times and coin 2 $n_2$ times. I would like to then be able to say that with a 90% confidence $p_2 -p_1$ is between some lower bound and some upper bound. How does one calculate this range for various confidence values?
1 Answers
Because the coins are independent, the variance of the difference in the point estimates of the proportion of heads is simply the sum of the variances: i.e., $$\widehat{\rm Var}[\hat p_2 - \hat p_1] = \widehat{\rm Var}[\hat p_1] + \widehat{\rm Var}[\hat p_2] = \frac{x_1(n_1 - x_1)}{n_1} + \frac{x_2(n_2 - x_2)}{n_2},$$ where $x_1, x_2$ are the respective number of times the first and second coins came up heads. Then you take the square root to get the standard error of the difference, and so a $100(1-\alpha)\%$ confidence interval can be constructed for sufficiently large $n_1$, $n_2$ as $$\frac{x_2}{n_2} - \frac{x_1}{n_1} \pm z_{1-\alpha/2} \sqrt{\frac{x_1(n_1-x_1)}{n_1} + \frac{x_2(n_2-x_2)}{n_2}}.$$ This CI is not good when $n_1$ or $n_2$ are small, or when $p_1$ or $p_2$ are close to 0 or 1. In that case, an exact interval can be calculated that guarantees $100(1-\alpha)\%$ coverage probability (but this tends to be overly conservative).
- 135,869