Skip to main content

Section 10.4 Interval Estimates - Confidence Interval for p

Sometimes selecting a value for p for a Binomial, Geometric, or Negative Binomial distribution problem can be done by using a theoretical value. Indeed, when flipping a coin it is reasonable to assume p = 1/2 is the probability of getting a head on one flip. Similarly, it is reasonable to assume p = 1/6 when you are looking for a particular side of a 6-sided die. However, many times you will want to deal with a problem in which it is not possible to determine exactly the precise value for the likelihood of success such as your true probability of making a free throw in basketball or knowing the true percentage of the electorate that will vote for your favorite candidate.

In these later situations, we found in the previous section that relative frequency \(\frac{Y}{n}\) is generally a good way to estimate p. In this section, you will investigate how to measure the closeness--and thereby assure some confidence in that estimate--regarding how well the point estimate approximates the actual value of p.

Definition 10.4.1 Confidence Intervals for p

Given a point estimate \(\tilde{p}\) for p, a confidence interval for p is a range of values which contains the actual value of p with high probability. In notation, a two-sided confidence interval for p is of the form

\begin{equation*} \tilde{p} - E_1 \lt p \lt \tilde{p} + E_2 \end{equation*}

with

\begin{equation*} P(\tilde{p} - E_1 \lt p \lt \tilde{p} + E_2) = 1 - \alpha \end{equation*}

where \(\alpha\) is near 0 and \(E_k \gt 0\text{.}\) One-sided confidence intervals for p can be similarly described

\begin{equation*} P( p \lt \tilde{p} + E_2) = 1 - \alpha \end{equation*}

or

\begin{equation*} P(\tilde{p} - E_1 \lt p) = 1 - \alpha. \end{equation*}

Generally, symmmetry is presumed when using a two-sided confidence interval so that \(E_1 = E_2 = E\) and therefore the interval looks like

\begin{equation*} P(\tilde{p} - E \lt p \lt \tilde{p} + E) = 1 - \alpha. \end{equation*}

In this case, E is known as the margin of error.

To determine E carefully, note that from the central limit theorem

\begin{equation*} \frac{Y-np}{\sqrt{np(1-p}} = \frac{\tilde{p} - p}{\sqrt{p(1-p)/n}} \end{equation*}

is approximately standard normal for large n. Presuming that \(\tilde{p} \approx p\) and replacing the unknown p terms on the bottom with \(\tilde{p}\) gives

\begin{equation*} z = \frac{\tilde{p} - p}{\sqrt{\tilde{p}(1-\tilde{p})/n}} \end{equation*}

where z is a standard normal distribution variable. So, using the central limit theorem and the standard normal distribution, you can find the value \(z_{ \alpha/2}\) where

\begin{equation*} P( -z_{ \alpha/2} \lt z \lt z_{ \alpha/2}) = 1 - \alpha \end{equation*}
\begin{equation*} P( -z_{ \alpha/2} \lt \frac{\tilde{p} - p}{\sqrt{\tilde{p}(1-\tilde{p})/n}} \lt z_{ \alpha/2}) = 1 - \alpha \end{equation*}

or by rearranging the inside inequality

\begin{equation*} P( \tilde{p} - z_{ \alpha/2}\sqrt{\tilde{p}(1-\tilde{p})/n} \lt p \lt \tilde{p} + z_{ \alpha/2}\sqrt{\tilde{p}(1-\tilde{p})/n}) = 1 - \alpha. \end{equation*}

Setting \(E = z_{ \alpha/2}\sqrt{\tilde{p}(1-\tilde{p})/n}\) gives a way to determine a confidence interval centered on \(\tilde{p} = \frac{Y}{n}\) for p with "confidence level" \(1-\alpha\text{.}\)

To complete the interval, one needs a specific value for \(z_{ \alpha/2}\text{.}\) Generally, one chooses confidence levels on the order of 90%, 95%, or 99% with 95% being the usual choice. Fortunately this value is easily computed using graphing calculators or other automatic methods although your ancient teacher might have been required to use tables. On a TI calculator, use

\begin{equation*} z_{\alpha /2} = \text{InvNorm}( 1 - \frac{\alpha}{2} ) \end{equation*}

For 90% confidence level, you need to find a z-value so that

\begin{equation*} P( -z_{ \alpha/2} \lt z \lt z_{ \alpha/2}) = 0.9 = 1 - 0.1 . \end{equation*}

Using the symmetry of the normal distribution, this can be rewritten

\begin{equation*} F(z_{ \frac{0.1}{2}}) = P( z \lt z_{ \frac{0.1}{2}}) = 0.95 = 1 - \frac{0.1}{2} . \end{equation*}

Using the inverse of the standard normal distribution (on the TI calculator this is InvNorm(0.95)) gives \(z_{ 0.05} \approx 1.645\text{.}\)

Similarly, for a 95 % confidence level, find where

\begin{equation*} F(z_{ \frac{0.05}{2}}) = P( z \lt z_{ \frac{0.05}{2}}) = 0.975 = 1 - \frac{0.05}{2} . \end{equation*}

The calculators InvNorm(0.975) gives \(z_{ 0.025} \approx 1.960\text{.}\)

For a 99 % confidence level, find where

\begin{equation*} F(z_{ \frac{0.01}{2}}) = P( z \lt z_{ \frac{0.01}{2}}) = 0.995 = 1 - \frac{0.01}{2} . \end{equation*}

The calculators InvNorm(0.995) gives \(z_{ 0.005} \approx 2.576\text{.}\)

Notice that when computing the confidence intervals above that we choose to just replace some of the p terms with \(\tilde{p}\) so that only one p term was left and could be isolated in the middle. There are other ways to deal with this. The easiest is to take the worst case scenario for the p terms in the denominator above. Indeed, the confidence interval is made wider (and therefore more likely to contain the actual p) if the square root term is as large as possible, using basic calculus it is easy to see that p(1-p) is maximized when p = 1/2. Therefore, a second alternative is to create your confidence interval using

\begin{equation*} z = \frac{\tilde{p} - p}{\frac{1}{2\sqrt{n}}} \end{equation*}

and therefore \(E = \frac{z_{ \alpha/2}}{2\sqrt{n}}\text{.}\) This method should be used only when trying to create the roughest and "safest" interval.

The methods for determining a confidence interval for p above depend upon a good approximation with the Central Limit Theorem. This approximation will be fine if n is relatively large. To consider a confidence interval for p when n is small, note that the binomial random variable is discrete and so expanding the interval by a factor of \(\frac{1}{2n}\) might be in order.

Another more elaborate mechanism when n is relatively large is given by the Wilson Score. This confidence interval is more complicated than just taking \(\tilde{p}\) and adding and subtracting E. This approach notes that the possible extreme values for p must satisfy (before replacing some of the p terms with \(\tilde{p}\))

Again, noting that \(\tilde{p} = \frac{Y}{n}\text{,}\) the expression above

\begin{equation*} \big | p - \tilde{p} \big | = z_{\alpha /2} \sqrt{\frac{p(1-p)}{n}} \end{equation*}

can be simplified by squaring both sides to get

\begin{equation*} \big ( p - \tilde{p} \big )^2 = z_{\alpha /2}^2 \frac{p(1-p)}{n}. \end{equation*}

Replacing \(\tilde{p}\) with the relative frequency gives

\begin{equation*} \big ( p - \frac{Y}{n} \big )^2 = z_{\alpha /2}^2 \frac{p(1-p)}{n} \end{equation*}

or by simplifying

\begin{equation*} (n+z_{\alpha /2}^2 )p^2 - (2Y+z_{/alpha /2}^2) p + \frac{Y^2}{2} = 0. \end{equation*}

Solving for p using the quadratic formula and simplifying ultimately results in the described interval.

Presume that from a sample of size n = 400 you get Y = 144 successes. Determine 95% two-sided confidence intervals for the actual p using all three of the methods above. Note that for each you will utilize \(z_{\alpha/2} = z_{0.025} = 1.960\) and \(\tilde{p} = \frac{144}{400} = 0.36\text{.}\)

Normal Interval:

\begin{equation*} P( 0.36 - 1.960 \sqrt{0.36 \cdot 0.64) / 400} \lt p \lt 0.36 + 1.960 \sqrt{0.36 \cdot 0.64) / 400}) = 1 - \alpha. \end{equation*}

or

\begin{equation*} P( 0.36 - 1.960 \cdot 0.6 \cdot 0.8) / 20 \lt p \lt 0.36 + 1.960 \cdot 0.6 \cdot 0.8) / 20) = 0.95 \end{equation*}

or

\begin{equation*} P( 0.36 - 0.04704 \lt p \lt 0.36 + 0.04704) = 0.95 . \end{equation*}

or

\begin{equation*} P( 0.31296 \lt p \lt 0.40704) = 0.95 . \end{equation*}

So, there is a 95% chance that the actual value for p lies inside the interval \((0.31296 , 0.40704).\)

Maximal Interval:

\begin{equation*} P( 0.36 - 1.960 \frac{1}{2\sqrt{400}} \lt p \lt 0.36 + 1.960 \frac{1}{2\sqrt{400}} ) = 1 - \alpha. \end{equation*}

or

\begin{equation*} P( 0.36 - 1.960 \frac{1}{40} \lt p \lt 0.36 + 1.960 \frac{1}{40} ) = 1 - \alpha. \end{equation*}

or

\begin{equation*} P( 0.311 \lt p \lt 0.409 ) = 1 - \alpha. \end{equation*}

Notice the interval is only slightly wider than when using \(\tilde{p}\) to estimate p in the first case.

Wilson Score Interval: Let's do this on in parts...

\begin{equation*} z_{\alpha/2} \sqrt{\frac{\tilde{p}(1-\tilde{p}) + \frac{z_{\alpha/2}^2}{4n}}{n}} = 1.96 \sqrt{ \frac{0.36 \cdot 0.64 + \frac{1.96^2}{1600}}{400}} \approx 0.04728 \end{equation*}

Therefore,

\begin{equation*} \frac{0.36 + \frac{1.96^2}{800} - 0.04728}{1 + \frac{1.96^2}{400}} \lt p \lt \frac{0.36 + \frac{1.96^2}{800} + 0.04728}{1 + \frac{1.96^2}{400}} \end{equation*}

or

\begin{equation*} 0.3145 \lt p \lt 0.4082 \end{equation*}

which is slightly different than the first and slightly smaller than the second.

Given a 99% confidence level, margin of error E=0.03, and preliminary estimate \(\tilde{p_0} = 0.35\text{,}\) notice that \(z_{\alpha / 2} = 2.58\) gives

\begin{equation*} n \gt \left ( \frac{2.58}{0.03} \right )^2 0.35 \cdot 0.65 \approx 1682.59 \end{equation*}

or a sample size of at least 1683.