5.2: Confidence intervals for a proportion
- Page ID
- 56933
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)The sample proportion \(\hat{p}\) provides a single plausible value for the population proportion \(p\). However, the sample proportion isn’t perfect and will have some standard error associated with it. When stating an estimate for the population proportion, it is better practice to provide a plausible range of values instead of supplying just the point estimate.
Capturing the population parameter
Using only a point estimate is like fishing in a murky lake with a spear. We can throw a spear where we saw a fish, but we will probably miss. On the other hand, if we toss a net in that area, we have a good chance of catching the fish. A is like fishing with a net, and it represents a range of plausible values where we are likely to find the population parameter.
If we report a point estimate \(\hat{p}\), we probably will not hit the exact population proportion. On the other hand, if we report a range of plausible values, representing a confidence interval, we have a good shot at capturing the parameter.
If we want to be very certain we capture the population proportion in an interval, should we use a wider interval or a smaller interval?
Constructing a 95% confidence interval
Our sample proportion \(\hat{p}\) is the most plausible value of the population proportion, so it makes sense to build a confidence interval around this point estimate. The standard error provides a guide for how large we should make the confidence interval.
The standard error represents the standard deviation of the point estimate, and when the Central Limit Theorem conditions are satisfied, the point estimate closely follows a normal distribution. In a normal distribution, 95% of the data is within 1.96 standard deviations of the mean. Using this principle, we can construct a confidence interval that extends 1.96 standard errors from the sample proportion to be that the interval captures the population proportion:
\[\begin{aligned} \text{point estimate}\ &\pm\ 1.96 \times SE \\ \hat{p}\ &\pm\ 1.96 \times \sqrt{\frac{p (1 - p)}{n}} %\label{95PercentConfidenceIntervalFormula}\end{aligned}\]
But what does “95% confident” mean? Suppose we took many samples and built a 95% confidence interval from each. Then about 95% of those intervals would contain the parameter, \(p\). Figure [95PercentConfidenceInterval] shows the process of creating 25 intervals from 25 samples from the simulation in Section 1.2, where 24 of the resulting confidence intervals contain the simulation’s population proportion of \(p = 0.88{}\), and one interval does not.
In Figure [95PercentConfidenceInterval], one interval does not contain \(p = 0.88{}\). Does this imply that the population proportion used in the simulation could not have been \(p = 0.88{}\)? Just as some observations naturally occur more than 1.96 standard deviations from the mean, some point estimates will be more than 1.96 standard errors from the parameter of interest. A confidence interval only provides a plausible range of values. While we might say other values are implausible based on the data, this does not mean they are impossible.
95% confidence interval for a parameter When the distribution of a point estimate qualifies for the Central Limit Theorem and therefore closely follows a normal distribution, we can construct a 95% confidence interval as
\[\begin{aligned} \text{point estimate} &\pm 1.96 \times SE \end{aligned}\]
In Section 1 we learned about a Pew Research poll where 88.7% of a random sample of 1000 American adults supported expanding the role of solar power. Compute and interpret a 95% confidence interval for the population proportion. [95p_ci_for_pew_solar_support] We earlier confirmed that \(\hat{p}\) follows a normal distribution and has a standard error of \(SE_{\hat{p}} = 0.010{}\). To compute the 95% confidence interval, plug the point estimate \(\hat{p} = 0.887{}\) and standard error into the 95% confidence interval formula:
\[\begin{aligned} \hat{p} \pm 1.96 \times SE_{\hat{p}} \quad\to\quad 0.887{} \pm 1.96 \times 0.010{} \quad\to\quad (0.8674, 0.9066) \end{aligned}\]
We are 95% confident that the actual proportion of American adults who support expanding solar power is between 86.7% and 90.7%. (It’s common to round to the nearest percentage point or nearest tenth of a percentage point when reporting a confidence interval.)
Changing the confidence level
Suppose we want to consider confidence intervals where the confidence level is higher than 95%, such as a confidence level of 99%. Think back to the analogy about trying to catch a fish: if we want to be more sure that we will catch the fish, we should use a wider net. To create a 99% confidence level, we must also widen our 95% interval. On the other hand, if we want an interval with lower confidence, such as 90%, we could use a slightly narrower interval than our original 95% interval.
The 95% confidence interval structure provides guidance in how to make intervals with different confidence levels. The general 95% confidence interval for a point estimate that follows a normal distribution is
\[\begin{aligned} \text{point estimate}\ \pm\ 1.96 \times SE\end{aligned}\]
There are three components to this interval: the point estimate, “1.96”, and the standard error. The choice of \(1.96\times SE\) was based on capturing 95% of the data since the estimate is within 1.96 standard errors of the parameter about 95% of the time. The choice of 1.96 corresponds to a 95% confidence level.
[leadInForMakingA99PercentCIExercise] If \(X\) is a normally distributed random variable, what is the probability of the value \(X\) being within 2.58 standard deviations of the mean?
Guided Practice [leadInForMakingA99PercentCIExercise] highlights that 99% of the time a normal random variable will be within 2.58 standard deviations of the mean. To create a 99% confidence interval, change 1.96 in the 95% confidence interval formula to be \(2.58\). That is, the formula for a 99% confidence interval is
\[\begin{aligned} \text{point estimate}\ \pm\ 2.58 \times SE %\label{99PercCIForProp}\end{aligned}\]
This approach – using the Z-scores in the normal model to compute confidence levels – is appropriate when a point estimate such as \(\hat{p}\) is associated with a normal distribution. For some other point estimates, a normal model is not a good fit; in these cases, we’ll use alternative distributions that better represent the sampling distribution.
Confidence interval using any confidence level If a point estimate closely follows a normal model with standard error \(SE\), then a confidence interval for the population parameter is
\[\begin{aligned} \text{point estimate}\ \pm\ z^{\star} \times SE \end{aligned}\]
where \(z^{\star}\) corresponds to the confidence level selected.
Figure [choosingZForCI] provides a picture of how to identify \(z^{\star}\) based on a confidence level. We select \(z^{\star}\) so that the area between -\(z^{\star}\) and \(z^{\star}\) in the standard normal distribution, \(N(0, 1)\), corresponds to the confidence level.
Margin of error [marginOfErrorTermBox] In a confidence interval, \(z^{\star}\times SE\) is called the .
Use the data in Example [95p_ci_for_pew_solar_support] to create a 90% confidence interval for the proportion of American adults that support expanding the use of solar power. We have already verified conditions for normality. We first find \(z^{\star}\) such that 90% of the distribution falls between -\(z^{\star}\) and \(z^{\star}\) in the standard normal distribution, \(N(\mu = 0, \sigma = 1)\). We can do this using a graphing calculator, statistical software, or a probability table by looking for an upper tail of 5% (the other 5% is in the lower tail): \(z^{\star}=1.65\). The 90% confidence interval can then be computed as
\[\begin{aligned} \hat{p}\ \pm\ 1.6449 \times SE_{\hat{p}} \quad\to\quad 0.887\ \pm\ 1.65 \times 0.0100 \quad\to\quad (0.8705, 0.9034) \end{aligned}\]
That is, we are 90% confident that 87.1% to 90.3% of American adults supported the expansion of solar power in 2018.
Confidence interval for a single proportion Once you’ve determined a one-proportion confidence interval would be helpful for an application, there are four steps to constructing the interval:
- Prepare.
-
Identify \(\hat{p}\) and \(n\), and determine what confidence level you wish to use.
- Check.
-
Verify the conditions to ensure \(\hat{p}\) is nearly normal. For one-proportion confidence intervals, use \(\hat{p}\) in place of \(p\) to check the success-failure condition.
- Calculate.
-
If the conditions hold, compute \(SE\) using \(\hat{p}\), find \(z^{\star}\), and construct the interval.
- Conclude.
-
Interpret the confidence interval in the context of the problem.
More case studies
In New York City on October 23rd, 2014, a doctor who had recently been treating Ebola patients in Guinea went to the hospital with a slight fever and was subsequently diagnosed with Ebola. Soon thereafter, an NBC 4 New York/The Wall Street Journal/Marist Poll found that 82% of New Yorkers favored a “mandatory 21-day quarantine for anyone who has come in contact with an Ebola patient”. This poll included responses of 1,042 New York adults between Oct 26th and 28th, 2014.
What is the point estimate in this case, and is it reasonable to use a normal distribution to model that point estimate? The point estimate, based on a sample of size \(n = 1042{}\), is \(\hat{p} = 0.82{}\). To check whether \(\hat{p}\) can be reasonably modeled using a normal distribution, we check independence (the poll is based on a simple random sample) and the success-failure condition (\(1042{} \times \hat{p} \approx 854{}\) and \(1042{} \times (1 - \hat{p}) \approx 188{}\), both easily greater than 10). With the conditions met, we are assured that the sampling distribution of \(\hat{p}\) can be reasonably modeled using a normal distribution.
Estimate the standard error of \(\hat{p} = 0.82{}\) from the Ebola survey. [seOfPropOfNYEbolaSurvey] We’ll use the substitution approximation of \(p \approx \hat{p} = 0.82{}\) to compute the standard error:
\[\begin{aligned} SE_{\hat{p}} = \sqrt{\frac{p(1-p)}{n}} \approx \sqrt{\frac{0.82{} (1 - 0.82{})}{1042{}}} = 0.012{} \end{aligned}\]
Construct a 95% confidence interval for \(p\), the proportion of New York adults who supported a quarantine for anyone who has come into contact with an Ebola patient. [ex_ci_ny_ebola_quarantine] Using the standard error \(SE = 0.012\) from Example [seOfPropOfNYEbolaSurvey], the point estimate 0.82, and \(z^{\star} = 1.96\) for a 95% confidence level, the confidence interval is
\[\begin{aligned} \text{point estimate} \ \pm\ z^{\star} \times SE \quad\to\quad 0.82{} \ \pm\ 1.96\times 0.012{} \quad\to\quad (0.796, 0.844) \end{aligned}\]
We are 95% confident that the proportion of New York adults in October 2014 who supported a quarantine for anyone who had come into contact with an Ebola patient was between 0.796 and 0.844.
Answer the following two questions about the confidence interval from Example [ex_ci_ny_ebola_quarantine]:
- What does 95% confident mean in this context?
- Do you think the confidence interval is still valid for the opinions of New Yorkers today?
[pew_wind_turbine_support_normal_dist_gp] In the Pew Research poll about solar energy, they also inquired about other forms of energy, and 84.8% of the 1000 respondents supported expanding the use of wind turbines.
- Is it reasonable to model the proportion of US adults who support expanding wind turbines using a normal distribution?
- Create a 99% confidence interval for the level of American support for expanding the use of wind turbines for power generation.
We can also construct confidence intervals for other parameters, such as a population mean. In these cases, a confidence interval would be computed in a similar way to that of a single proportion: a point estimate plus/minus some margin of error. We’ll dive into these details in later chapters.
Interpreting confidence intervals
In each of the examples, we described the confidence intervals by putting them into the context of the data and also using somewhat formal language:
- Solar.
-
We are 90% confident that 87.1% to 90.4% of American adults support the expansion of solar power in 2018.
- Ebola.
-
We are 95% confident that the proportion of New York adults in October 2014 who supported a quarantine for anyone who had come into contact with an Ebola patient was between 0.796 and 0.844.
- Wind Turbine.
-
We are 99% confident the proportion of Americans adults that support expanding the use of wind turbines is between 81.9% and 87.7% in 2018.
First, notice that the statements are always about the population parameter, which considers all American adults for the energy polls or all New York adults for the quarantine poll.
We also avoided another common mistake: incorrect language might try to describe the confidence interval as capturing the population parameter with a certain probability. Making a probability interpretation is a common error: while it might be useful to think of it as a probability, the confidence level only quantifies how plausible it is that the parameter is in the given interval.
Another important consideration of confidence intervals is that they are only about the population parameter. A confidence interval says nothing about individual observations or point estimates. Confidence intervals only provide a plausible range for population parameters.
Lastly, keep in mind the methods we discussed only apply to sampling error, not to bias. If a data set is collected in a way that will tend to systematically under-estimate (or over-estimate) the population parameter, the techniques we have discussed will not address that problem. Instead, we rely on careful data collection procedures to help protect against bias in the examples we have considered, which is a common practice employed by data scientists to combat bias.
Consider the 90% confidence interval for the solar energy survey: 87.1% to 90.4%. If we ran the survey again, can we say that we’re 90% confident that the new survey’s proportion will be between 87.1% and 90.4%?


