CI for difference between two population proportions
Let $X_1$ be the observed number of individuals possessing certain attributes (number of successes) in a random sample of size $n_1$ from a large population with population proportion $p_1$ and let $X_2$ be the observed number of individuals possessing certain attributes (number of successes) in a random sample of size $n_2$ from a large population with population proportion $p_2$. The two sample are independent. Then $\hat{p_1}=\dfrac{X_1}{n_1}$ and $\hat{p_2}=\dfrac{X_2}{n_2}$.
Let $C=1-\alpha$ be the confidence coefficient. Our objective is to construct a $100(1-\alpha)$% confidence interval estimate of the difference between two population proportions $(p_1-p_2)$.
The margin of error for the difference $(p_1-p_2)$ is
$$ \begin{aligned} E = Z_{\alpha/2} \sqrt{\frac{\hat{p}_1*(1-\hat{p}_1)}{n_1}+\frac{\hat{p}_2*(1-\hat{p}_2)}{n_2}} \end{aligned} $$
where $Z_{\alpha/2}$ is the value from normal statistical table.
Then $100(1-\alpha)$% confidence interval for the difference $(p_1-p_2)$ is
$$ \begin{aligned} (\hat{p}_1-\hat{p}_2) - E \leq (p_1 -p_2) \leq (\hat{p}_1 -\hat{p}_2)+ E. \end{aligned} $$
Assumptions
a. The sample proportions are from the two random samples that are independent.
b. For each of the two samples $np\geq 5$ and $n(1-p)\geq 5$.
Step by Step Procedure
Step by step procedure to estimate the confidence interval for difference between two population proportions is as follows:
Step 1 Specify the confidence level $(1-\alpha)$
Step 2 Given information
Specify the given information, sample sizes $n_1$ and $n_2$. The observed number of successes $X_1$ and $X_2$. The estimates of population proportions are $\hat{p}_1 =\dfrac{X_1}{n_1}$ and $\hat{p}_2 = \dfrac{X_2}{n_2}$.
Step 3 Specify the formula
$100(1-\alpha)$% confidence interval for the difference $(p_1-p_2)$ is
$$ \begin{aligned} (\hat{p}_1-\hat{p}_2) - E \leq (p_1 -p_2) \leq (\hat{p}_1 -\hat{p}_2)+ E. \end{aligned} $$
where $E = Z_{\alpha/2} \sqrt{\frac{\hat{p}_1*(1-\hat{p}_1)}{n_1}+\frac{\hat{p}_2*(1-\hat{p}_2)}{n_2}}$
.
Step 4 Determine the critical value
Determine the critical value $Z_{\alpha/2}$ from the normal statistical table that corresponds to the desired confidence level.
Step 5 Compute the margin of error
The margin of error for the difference $(p_1-p_2)$ is
$$ \begin{aligned} E = Z_{\alpha/2} \sqrt{\frac{\hat{p}_1*(1-\hat{p}_1)}{n_1}+\frac{\hat{p}_2*(1-\hat{p}_2)}{n_2}}. \end{aligned} $$
Step 6 Determine the confidence interval
Thus, $100(1-\alpha)$% confidence interval estimate for the difference $(p_1-p_2)$ is $(\hat{p}_1 -\hat{p}_2) \pm E$ or $\big((\hat{p}_1-\hat{p}_2) -E, (\hat{p}_1-\hat{p}_2) +E\big)$.