# Finding a confidence interval for different of proportions

Let two independent random variables, $$Y_1$$ and $$Y_2$$ that have binomial distribution have parameters $$n_1 = n_2 = 100$$, $$p_1$$ and $$p_2$$, respectively, be observed to be equal to $$y_1 = 50$$ and $$y_2 = 40$$. Determine an approximate $$90\%$$ confidence interval for $$p_1 - p_2$$.

I'm pretty new to confidence intervals and wanted help on this problem from my book. I have tried to apply the following definition:

Let $$X_1, X_2, \ldots, X_n$$ be a sample on a random variable $$X$$, where $$X$$ has p.d.f. $$f(x;\theta)$$, where $$\theta\in \Omega$$. Let $$0 < \alpha < 1$$ be specified. Let $$L = L(X_1, \ldots, X_n)$$ and $$U = U(X_1, \ldots, X_n)$$ be two statistics. We say that $$(L, U)$$ is a $$(1 - \alpha)100\%$$ confidence interval for $$\theta$$ if $$1 - \alpha = P_{\theta}(\theta \in (L, U))$$.

However, I have been having trouble applying this definition directly. I can identify $$\alpha = 0.1$$ here, which means that I think we want $$P(L < p_1 - p_2 < U) = 0.9$$. Now I'm really not sure how to use this information to get the answer; I have no clue where the observed values would come into play.

Any help is appreciated.

The idea is that the sample averages $$Y_1/n_1$$ and $$Y_2/n_2$$ should be good approximations of the proportions $$p_1$$ and $$p_2$$ respectively. We can use the observed value $$y_1/n_1 - y_2/n_2$$ as a point estimate of $$p_1 - p_2$$, and get a confidence interval by figuring out the approximate distribution of $$Y_1/n_1 - Y_2/n_2$$.
Because of the Central Limit Theorem, we know that the distribution $$\operatorname{Bin}(n, p)$$ is approximately normal with mean $$np$$ and variance $$np(1-p)$$. Therefore since $$Y_1$$ and $$Y_2$$ are independent, the random variable $$Y_1/n_1 - Y_2/n_2$$ is approximately distributed like a normal random variable with mean $$p_1 - p_2$$ and variance $$p_1(1-p_1)/n_1 + p_2(1-p_2)/n_2$$. After standardizing this tells us that the test statistic $$\frac{(Y_1/n_1 - Y_2/n_2) - (p_1 - p_2)}{\sqrt{p_1(1-p_1)/n_1 + p_2(1-p_2)/n_2}}$$ approximately follows a standard normal distribution. Using this, a little bit of algebraic manipulation will show that $$\mathbb{P} \left( | (p_1 - p_2) - (Y_1/n_1 - Y_2/n_2)| \leq 1.645 \sqrt{p_1(1-p_1)/n_1 + p_2(1-p_2)/n_2} \right) = 90\%$$ (the number $$1.645$$ comes from the $$95$$th percentile of a standard normal distribution) So an approximate $$90$$% confidence interval would be $$(Y_1/n_1 - Y_2/n_2) \pm 1.645 \sqrt{p_1(1-p_1)/n_1 + p_2(1-p_2)/n_2}.$$ The only problem is that $$p_1$$ and $$p_2$$ still appear in this expression, but they are unknown. One standard way to fix this is just to replace $$p_1$$ and $$p_2$$ by their point estimates $$Y_1/n_1$$ and $$Y_2/n_2$$ in the above expression, and you are still left with a pretty good approximation.
• I'm confused about why you use $1.645$ in a $90\%$ confidence interval instead of $1.28$ if $\Phi(1.28) = 0.9$? – user882487 Mar 11 at 14:39
• Just to make sure I understand: Would it end up being $(50/100 - 40/100) \pm 1.645\sqrt{\cdots}$? And in the square-root, I'd substitute $p_i = Y_i/n_i$ – user882487 Mar 11 at 14:46