Confidence interval for a proportion

This document is prepared automatically using the following R command.


Confidence interval of a sample proportion

The approach that we used to solve this problem is valid when the following conditions are met.

If the population size is much larger than the sample size, we can use an approximate formula for the standard deviation or the standard error. This condition is satisfied, so we will use one of the simpler approximate formulas.


Since the above requirements are satisfied, we can use the following four-step approach to construct a confidence interval.

1. Identify a sample statistic.

Since we are trying to estimate a population proportion, we choose the sample proportion (0.4) as the sample statistic.

2. Select a confidence level.

In this analysis, the confidence level is defined for us in the problem. We are working with a 99% confidence level.

3. Find the margin of error.

Find standard deviation or standard error.

Since we do not know the population proportion, we cannot compute the standard deviation; instead, we compute the standard error. And since the population is more than 20 times larger than the sample, we can use the following formula to compute the standard error (SE) of the proportion:

Since we do not know the standard deviation of the population, we cannot compute the standard deviation of the sample mean; instead, we compute the standard error (SE). Because the sample size is much smaller than the population size, we can use the “approximate” formula for the standard error.

\[ SE= \sqrt{\frac{p(1-p)}{n}}\] where \(p\) is the sample proportion, \(n\) is the sample size.


Find the critical probability(p*):


The degree of freedom(df) is: \[df=n-1=1600-1=1599\]

The critical value is the z statistic having a cumulative probability equal to 0.995.

We can get the critical value using the following R code.


Alternatively, we find that the critical value is 2.576 from the z Distribution table.

The graph shows the \(\alpha\) values are the tail areas of the distribution.

Compute margin of error(ME):

\[ME=critical\ value \times SE\] \[ME=2.576 \times 0.012=0.032\]

Specify the confidence interval. The range of the confidence interval is defined by the sample statistic \(\pm\)margin of error. And the uncertainty is denoted by the confidence level.

4. Confidence interval of the proportion

Therefore, the 99% confidence interval is 0.37 to 0.43. That is, we are 99% confident that the true proportion is in the range 0.37 to 0.43.

Result of propCI()

# A tibble: 1 × 1
1 NA   

  alpha    n   df   p P         se critical         ME     lower     upper
1  0.01 1600 1599 0.4 0 0.01224745 2.575829 0.03154734 0.3684527 0.4315473
                      CI        z        pvalue alternative
1 0.40 [99CI 0.37; 0.43] 32.65986 5.804914e-234   two.sided

propCI(n = 1600, p = 0.4, alpha = 0.01)

[1] "prop"


The contents of this document are modified from Berman H.B., “AP Statistics Tutorial”, [online] Available at: URL[Accessed Data: 1/23/2022].