A **confidence interval (C.I.) for a difference in proportions **is a range of values that is likely to contain the true difference between two population proportions with a certain level of confidence.

This tutorial explains the following:

- The motivation for creating this confidence interval.
- The formula to create this confidence interval.
- An example of how to calculate this confidence interval.
- How to interpret this confidence interval.

**C.I. for the Difference in Proportions: Motivation**

Often researchers are interested in estimating the difference between two population proportions. To estimate this difference, they’ll go out and gather a random sample from each population and calculate the proportion for each sample. Then, they can compare the difference between the two proportions.

However, they can’t know for sure if the difference in the sample proportons matches the true difference in the population proportions which is why they may create a confidence interval for the difference between the two proportions. This provides a range of values that is likely to contain the true difference between the population proportions.

For example, suppose we want to estimate the difference in the proportion of residents who support a certain law in county A compared to the proportion who support the law in county B.

Since there are thousands of residents in each county, it would take too long and be too costly to go around and survey every individual resident in each county.

Instead, we might take a simple random sample of residents from each county and use the proportion in favor of the law in each sample to estimate the true difference in proportions between the two counties:

Since our samples are random, the difference in proportions between the two samples is not guaranteed to exactly match the difference in proportions between the two populations. So, to capture this uncertainty we can create a confidence interval that contains a range of values that are likely to contain the true difference in proportions between the two populations.

**C.I. for the Difference in Proportions:**** Formula**

We use the following formula to calculate a confidence interval for a difference between two population proportions:

**Confidence interval = (p _{1}–p_{2}) +/- z*√(p_{1}(1-p_{1})/n_{1 }+ p_{2}(1-p_{2})/n_{2})**

where:

- p
_{1}, p_{2}: sample 1 proportion, sample 2 proportion - z: the z-critical value based on the confidence level
- n
_{1}, n_{2}: sample 1 size, sample 2 size

The z-value that you will use is dependent on the confidence level that you choose. The following table shows the z-value that corresponds to popular confidence level choices:

Confidence Level |
z-value |
---|---|

0.90 | 1.645 |

0.95 | 1.96 |

0.99 | 2.58 |

Notice that higher confidence levels correspond to larger z-values, which leads to wider confidence intervals. This means that, for example, a 95% confidence interval will be wider than a 90% confidence interval for the same set of data.

**C.I. for the Difference in Proportions: ****Example**

Suppose we want to estimate the difference in the proportion of residents who support a certain law in county A compared to the proportion who support the law in county B. Here is the summary data for each sample:

**Sample 1:**

- n
_{1}= 100 - p
_{1}= 0.62 (i.e. 62 out of 100 residents support the law)

**Sample 2:**

- n
_{2}= 100 - p
_{2}= 0.46 (i.e. 46 our of 100 residents support the law)

Here is how to find various confidence intervals for the difference in population proportions:

**90% Confidence Interval:**

(.62-.46) +/- 1.645*√(.62(1-.62)/100 + .46(1-.46)/100) =** [.0456, .2744]
**

**95% Confidence Interval:**

(.62-.46) +/- 1.96*√(.62(1-.62)/100 + .46(1-.46)/100) = ** [.0236, .2964]**

**99% Confidence Interval:**

(.62-.46) +/- 2.58*√(.62(1-.62)/100 + .46(1-.46)/100) =** [-0.0192, 0.3392]**

**Note: **You can also find these confidence intervals by using the Confidence Interval for the Difference in Proportions Calculator.

**C.I. for the Difference in Proportions****: Interpretation**

The way we would interpret a confidence interval is as follows:

There is a 95% chance that the confidence interval of [.0236, .2964] contains the true difference in the proportion of residents who favor the law between the two counties.

Since this interval does not contain the value “0” it means that it’s highly likely that there is a true difference in the proportion of residents who support this law in County A compared to county B.

Hi Zach,

Thanks for your article!

I was curious to know whether one could the same test method if one gets 2 proportions, but just one sample. Typically imagine you have a sample n=200 of a large country population.

100 support law A

120 support law B (it is possible to support both laws).

Could you still use the same logic?