# 23 Confidence intervals for one proportion

So far, you have learnt to ask a RQ, design a study, describe and summarise the data, understand how sample statistics vary from sample to sample.
**In this chapter**, you will learn to construct *confidence intervals* for one proportion.
You will learn to:

- identify situations where estimating a proportion is appropriate.
- form confidence intervals for single proportions.
- determine whether the conditions for using the confidence intervals apply in a given situation.

## 23.1 Sampling distribution for \(\hat{p}\): known proportion

Suppose a fair, six-sided die is rolled \(25\) times.
What proportion of the rolls will produce an even number?
That is, what will be the value of the *sample proportion* of numbers that are even?
Of course, no-one knows, because the proportion of rolls that will be even will not be the same for every sample of \(25\) rolls.
The sample proportion *varies* from sample to sample: *sampling variation* exists.

As seen in Chap. 20, the sample statistic often varies with a normal distribution (whose standard deviation is called the *standard error*).
However, being more specific about the details of the normal distribution is useful.

Remember: studying a sample leads to the following observations:

- Every sample is likely to be different.
- We observe just one of the many possible samples.
- Every sample is likely to yield a different value for the statistic.
- We observe just one of the many possible values for the statistic.

Since many values for the sample proportion are possible, the values of the sample proportion vary (called *sampling variation*) and have a *distribution* (called a *sampling distribution*).

To better understand the sampling distribution for the proportion of even numbers in \(25\) rolls of a die, statistical theory could be used, or thousands of repetitions of a sample of \(25\) rolls could be performed, or a computer could *simulate* many samples of \(25\) rolls (as in Sect. 20.2 for a roulette wheel).

Here, the *population proportion* of even rolls is \(p = 0.5\) (using the classical approach to probability: three of the six faces of the die are even).
Each sample of \(n = 25\) rolls produces a *sample* proportion, denoted by \(\hat{p}\), which varies from sample to sample.

The sample proportions would be expected to vary around \(p = 0.5\) (the *population proportion*).
Of course, the value of the sample proportion in \(25\) rolls could be very small or very high by chance, but we wouldn't expect to see that very often.
The sample proportions exhibit sampling variation, and the *amount* of sampling variation is quantified using a *standard error*.

\(p\) refers to the *population* proportion, and \(\hat{p}\) refers to a *sample* proportion.

Suppose a fair die was rolled \(25\) times, and this was repeated *thousands* of times, and the proportion of even rolls was recorded for every one of those thousands of samples.
These thousands of sample proportions \(\hat{p}\) (one from every sample of \(n = 25\) rolls) could be shown using a
histogram; see the animation below.

The shape of the histogram is roughly a normal distribution.
The sampling distribution will always be approximately a normal distribution when certain conditions are met: see Sect. 23.6.
The mean of this distribution is called the *sampling mean*, and the standard deviation for this sampling distribution is called the *standard error*, denoted \(\text{s.e.}(\hat{p})\) (see Fig. 23.1).

More specifically, the *values* of the mean and standard deviation of the normal distribution
the animation above
can be determined:

- the
*sampling mean*has the value of \(p = 0.5\), - the standard deviation, called the
*standard error*\(\text{s.e.}(\hat{p})\), has the value \(0.1\). (Where this number comes from will be revealed later, in Eq. (23.2).)

This distribution is the *sampling distribution* (Sect. 20.1), whose standard deviation is called a *standard error*.
A picture of this normal distribution can be drawn (Fig. 23.1).
While we still don't know *exactly* what the next roll will produce, we have some idea of *how* the sample proportion varies in samples of \(25\) rolls.
For instance, values of \(\hat{p}\) less than \(0.2\), or greater than \(0.8\) are unlikely to be observed from a fair die.

More generally, the sampling distribution can be described as follows.

**Definition 23.1 (Sampling distribution of a sample proportion with $p$ known) **When the value of \(p\) is *known*, the *sampling distribution of the sample proportion* is (when certain conditions are met; Sect. 23.6) described by

- an approximate normal distribution,
- centred around the sampling mean whose value is \(p\),
- with a standard deviation (called the
*standard error*of \(\hat{p}\)), denoted \(\text{s.e.}(\hat{p})\), whose value is \[\begin{equation} \text{s.e.}(\hat{p}) = \sqrt{\frac{ p \times (1 - p)}{n}}, \tag{23.1} \end{equation}\] where \(n\) is the size of the sample used to compute \(\hat{p}\), and \(p\) is the population proportion.

The parameter \(p\) and the statistic \(\hat{p}\) are both *proportions*.

However, the *average value* of the sample proportions can be described by a *sampling mean*, whose value is \(p\), and the amount of variation in the sample proportions can be described by a *standard deviation* (called a *standard error* in this context), denoted \(\text{s.e.}(\hat{p})\).

The sampling mean of the sampling distribution is the 'average' value of all possible sample proportions, \(\hat{p}\).

For the die example, where \(n = 25\) rolls and the population proportion of even rolls is \(p = 0.5\): \[\begin{equation} \text{s.e.} (\hat{p}) = \sqrt{\frac{0.5 \times (1 - 0.5)}{25}} = 0.1. \tag{23.2} \end{equation}\] This standard error is the standard deviation of the normal distribution in Fig. 23.1. However, almost always, the value of \(p\) is unknown. This situation is studied from Sect. 23.3 onwards.

## 23.2 Sampling intervals: known proportion

Since the possible values of the sample proportions \(\hat{p}\) can be described by an approximate *normal distribution*, the \(68\)--\(95\)--\(99.7\) rule (Def. 21.1) applies.
For example, in Fig. 23.1 (where the sampling mean is \(0.5\) and the standard error is \(0.1\)), about \(68\)% of the time, a sample of \(25\) rolls will have a value of \(\hat{p}\) between \(0.5\) give-or-take *one* standard deviation (that is, give-or-take \(0.1\)).
So, about \(68\)% of the time, the proportion of even rolls in a sample of \(25\) rolls will be between \(0.5 - 0.1 = 0.4\) and \(0.5 + 0.1 = 0.6\).
Similarly, about \(95\)% of the time, the proportion of even rolls will be between \(0.5\) give-or-take \((2\times0.1\)), or between \(0.3\) and \(0.7\).

These intervals tell us what values of \(\hat{p}\) are likely to be observed in samples of size \(25\). Most of the time (i.e., approximately \(95\)% of the time), the value of \(\hat{p}\) is expected to be between \(0.30\) and \(0.70\) (Fig. 23.2).

Formally, the sample proportion \(\hat{p}\) is likely to lie within the interval
\[
p \pm (\text{multiplier} \times \text{s.e.}(\hat{p})),
\]
where \(\text{s.e.}(\hat{p})\) is the *standard error of the sample proportion* (calculated using Eq. (23.1)), and the *multiplier* comes from the \(68\)--\(95\)--\(99.7\) rule, depending on the level of coverage being sought.
This is called a *sampling interval*.

The symbol '\(\pm\)' means 'plus or minus', or (colloquially) 'give-or-take'.

The *multiplier* depends on how confident we wish to be that the interval contains the value of \(\hat{p}\).
For a \(95\)% interval, the multiplier is *approximately* \(2\), based on the \(68\)--\(95\)--\(99.7\) rule: approximately \(95\)% of observations are within *two* standard deviations of the value of \(p\) (the mean of the normal distribution in Fig. 23.1).
That is, the *approximate* \(95\)% sampling interval is:
\[\begin{equation}
p \pm (2 \times \text{s.e.}(\hat{p}) ).
\tag{23.3}
\end{equation}\]
CIs are commonly \(95\)% CIs, but *any* level of confidence can be used (but a different multiplier is needed).
In this book, a multiplier of \(2\) is used when *approximate* \(95\)% CIs are created manually, and otherwise software is used.
Commonly, CIs are computed at \(90\)%, \(95\)% and \(99\)% confidence levels.

## 23.3 Sampling distribution for \(\hat{p}\): unknown proportion

In the die example (Sects. 23.1 and 23.2), the value of \(p\) was known.
However, usually the value of \(p\) (the *parameter*) is *unknown*; after all, the reason for taking a sample is to *estimate* the unknown value of \(p\).
When the value of \(p\) is unknown, the standard error is computed using the best available estimate of \(p\), which is \(\hat{p}\).

**Definition 23.2 (Sampling distribution of a sample proportion with $p$ unknown) **When the value of \(p\) is *unknown*, the *sampling distribution of the sample proportion* is (when certain conditions are met; Sect. 23.6) described by

- an approximate normal distribution,
- centred around the sampling mean, whose value is \(p\),
- with a standard deviation (called the
*standard error*of \(\hat{p}\)) whose value is \[\begin{equation} \text{s.e.}(\hat{p}) = \sqrt{\frac{ \hat{p} \times (1-\hat{p})}{n}}, \tag{23.4} \end{equation}\] where \(n\) is the size of the sample used to compute \(\hat{p}\), and \(\hat{p}\) is the sample proportion. In general, the approximation gets better as the sample size gets larger.

When computing the standard error for a proportion, take care!

Make sure you use a *proportion* in the formula, not a *percentage* (i.e., \(0.5\) rather than \(50\)%).
Also: don't forget to take the square root!

## 23.4 Confidence intervals for \(p\): unknown proportion

Let's pretend for the moment that the population proportion of even rolls on a die is *unknown* (to demonstrate ideas).
An *estimate* of the population proportion of even rolls can be found by rolling a die \(n = 25\) times, and computing \(\hat{p}\) (an estimate of \(p\)).
Suppose \(11\) of the \(n = 25\) rolls produce an even number, so \(\hat{p} = 11/25 = 0.44\).
The best estimate of \(p\) is therefore \(\hat{p} = 0.44\).

Then, using Def. 23.2, the sample proportions will vary with an approximate normal distribution around \(p\) (whose value is unknown), with a standard deviation (called the standard error) of \[ \text{s.e.}(\hat{p}) = \sqrt{\frac{ 0.44 \times (1 - 0.44)}{25}} = 0.09927739. \] Previously, the sampling distribution was used to construct a sampling interval that was likely to contain the value of \(\hat{p}\). However, here the value of \(\hat{p}\) is known, so instead an interval is created that is likely to contain the value of \(p\) (Fig. 23.3).

The unknown value of \(p\) could be a little smaller or a little larger than the value of \(\hat{p}\); the interval is
\[
\hat{p} \pm \left(\text{multiplier}\times\text{s.e.}(\hat{p})\right)
\]
for a suitable multiplier.
This interval for \(p\) is called a *confidence interval*.
The multiplier is a \(z\)-score, and the \(68\)--\(95\)--\(99.7\) rule gives approximate values for the multipliers.
The give-or-take amount, called the *margin of error*, is \(\left(\text{multiplier}\times\text{s.e.}(\hat{p})\right)\).

Using the approximate multiplier of \(2\) (from the \(68\)--\(95\)--\(99.7\) rule), the approximate \(95\)% CI is \[ 0.44 \pm (2 \times 0.099277), \quad\text{or $0.44\pm 0.1986$} \] (i.e., the margin of error is \(0.1986\)). That is, the interval is from \[\begin{align*} 0.44 - 0.1986 &\qquad\text{(which is $0.241$)}\\ \text{to}\quad 0.44 + 0.1986 &\qquad\text{(which is $0.639$)}. \end{align*}\] The interval, from \(0.2414\) to \(0.639\), is an interval containing values of \(p\) that could have reasonably produced the observed value of \(\hat{p}\) (Fig. 23.4) via sampling variation. We can say the interval \(0.2414\) to \(0.639\) has a \(95\)% chance of straddling the population proportion \(p\).

**Definition 23.3 (Confidence interval for $p$) **A *confidence interval* (CI) for the unknown value of the population proportion \(p\) is
\[\begin{equation}
\hat{p} \pm ( \text{multiplier} \times \text{s.e.}(\hat{p})),
\tag{23.5}
\end{equation}\]
where \(( \text{multiplier} \times \text{s.e.}(\hat{p}))\) is the *margin of error*, and
\[
\text{s.e.}(\hat{p})
=
\sqrt{\frac{ \hat{p} \times (1 - \hat{p}) }{n}}
\]
is the *standard error* of \(\hat{p}\), where \(\hat{p}\) is the sample proportion, and \(n\) is the sample size.
For an *approximate* \(95\)% CI, the multiplier is \(2\).
The quantity \(( \text{multiplier} \times \text{s.e.}(\hat{p}))\) is called the *margin of error*.

In general, we do not know if the computed confidence interval straddles the actual value of \(p\), since the value of \(p\) is usually unknown.
However, in this contrived example, the CI *does* straddle the known value of \(p = 0.5\) with \(95\)% confidence.

In this case, we know the value of the population parameter: \(p = 0.5\).
Usually we do *not* know the value of the parameter.
After all, that's why we take a sample: to *estimate* the value of the unknown population proportion.

Suppose *thousands* of people rolled a die \(25\) times, and *each* person found \(\hat{p}\) for their sample, and hence computed the CI for their sample of \(25\) rolls.
Every sample of \(25\) rolls could produce a different estimate \(\hat{p}\), and so a different value for \(\text{s.e.}(\hat{p})\), and hence a different \(95\)% CI.
However, *about \(95\)% of these thousands of confidence intervals from those thousands of samples would straddle the true proportion \(p\)*.

Since we usually don't know the value of \(p\), and we usually only have one sample (and hence one CI), in general *we never know whether the CI computed from the single sample we have straddles the value of \(p\) or not*.

Again, consider letting the computer simulate the situation. Suppose the process of recording the sample proportion of even numbers in \(n = 25\) rolls is repeated fifty times, and for each of those fifty sets of 25 rolls a CI is produced (see the animation below). About \(95\)% of those \(95\)% CIs straddle the value \(p = 0.5\) (shown as solid lines), but some do not (shown as dashed lines). Of course, since the value of \(p\) is usually unknown, we never know if the CI computed from our single sample contains \(p\) or not.

**Definition 23.4 (Confidence interval) **Informally: a *confidence interval* (CI) is an interval likely to contain the unknown value of the parameter.

More formally, a CI is an interval which contains the unknown parameter a given percentage of the time (over repeated sampling).

In general, higher confidence means wider intervals (Fig. 23.5), since wider intervals are needed to be more certain that the interval contains \(\hat{p}\). Try changing the confidence level for the CI in the interaction below.

Using the \(68\)--\(95\)--\(99.7\) rule produces *approximate* multipliers and hence *approximate* CIs.
In reality, finding the exact multipliers (and hence exact CIs) is more involved.

In this book, we use multipliers from the \(68\)--\(95\)--\(99.7\) rule and create *approximate* CIs.
Except for small sample sizes, the approximations are generally very good.
To form *exact* CIs, software would be used.

## 23.5 Interpretation of a CI

The *correct* interpretation (see Def. 23.4) of a \(95\)% CI is the following:

If the same size samples were repeatedly taken many times, and the \(95\)% confidence interval computed for each sample, \(95\)% of these confidence intervals formed would contain the population parameter.

In Sect. 23.4, the CI was interpreted as giving a range of values of \(p\) that could reasonably be expected to produce the observed value of \(\hat{p}\). The CI can also be seen as having a \(95\)% chance of straddling the unknown value of the parameter. These are close to the correct interpretation.

Commonly, the CI is interpreted as having a \(95\)% chance of containing the value of population parameter \(p\).
This is not strictly correct (the CI either *does* or *does not* contain the value of \(p\)), but is like a convenience that captures the essence of the correct interpretation.
More details on interpreting a CI are given in Sect. 25.3.

## 23.6 Statistical validity conditions

The confidence intervals formed in this chapter assume the sampling distribution is approximately a normal distribution (and so, for example, the \(68\)--\(95\)--\(99.7\) rule applies).
This is true if certain conditions are met.
If these conditions are met, the confidence interval is *statistically valid*.
Whenever a confidence interval is formed, the relevant statistical validity conditions need to be checked.

If the statistical validity conditions are not met, resampling methods may be used (Efron and Hastie 2021).

**Definition 23.5 (Statistical validity) **A result is *statistically valid* if the conditions for the underlying mathematical calculations and assumptions to be approximately correct are met, such as the sampling distribution having an approximate normal distribution.

**Example 23.1 (Statistical validity analogy) **Suppose your doctor asks you to get a blood test, after fasting (refraining from eating) for \(12\) hours before your test.

The next day, you have a big breakfast, lunch at a cafe, and then have your blood test. Your blood is analysed, and your doctor is sent the results of the blood test.

Since you did not fast, the results may or may not be valid.
The doctor can learn *something*, but not as much as if you had followed instructions.
Similarly, if the conditions for computing the confidence interval are not met, the calculations still produce a CI, but the results may be slightly unreliable.

The CI for a single proportion is *statistical validity* if:

- the number of individuals of interest exceeds \(5\),
*and* - the number of individuals
*not*of interest exceeds \(5\).

The value of \(5\) here is a rough figure; some books give other values (such as \(10\)).
These conditions ensure that the sampling distribution of \(\hat{p}\) has an approximate normal distribution, so that the \(68\)--\(95\)--\(99.7\) rule (approximately) applies.
If this condition is not met, the normal distribution may not approximate the sampling distribution well, so the \(68\)--\(95\)--\(99.7\) rule may be inappropriate, and so the CI may also be slightly unreliable.
The units of analysis are also assumed to be *independent* (e.g., from a simple random sample).

**Example 23.2 (Statistical validity) **For the die-throwing example in Sect. 23.3, \(11\) even rolls and \(14\) odd rolls were observed.
Both these values exceed \(5\), so the CI is statistically valid.

**Example 23.3 (Statistical validity conditions) **Consider a situation where \(p = 0.1\) is the population proportion of some 'positive result'.

A sample of size \(n = 10\) is taken, with one positive result: \(\hat{p} = 0.1\).
The statistical validity conditions *are not* satisfied, and the sampling distribution is not well modelled by a normal distribution (Fig. 23.6, left panel).
Using a normal distribution to model the sampling distribution would be silly.

In contrast, assume a sample of size \(n = 150\) is taken, with \(15\) positive results: \(\hat{p} = 0.1\) again.
However, in this case, the statistical validity conditions *are* satisfied, and the sampling distribution is well modelled by a normal distribution (Fig. 23.6, right panel).

## 23.7 Example: female coffee drinkers

Kelpin et al. (2018) studied \(360\) female college students in the United States, and found that \(61\) drank coffee daily.
The unknown parameter is \(p\), the *population* proportion of female college students in the United States that drink coffee daily.

The sample size is \(n = 360\), and the *sample* proportion of daily coffee drinkers is \(\hat{p} = 61/360 = 0.16944\).
Of course, the sample proportion varies from sample to sample, so the sample proportion has *sampling variation*, measured by the *standard error*:
\[
\text{s.e.}(\hat{p})
= \sqrt{ \frac{ 0.16944 \times (1 - 0.16944)}{360}}
= 0.01977.
\]
An *approximate* \(95\)% CI is \(0.16944 \pm (2 \times 0.01977)\), or \(0.16944 \pm 0.03954\) (i.e., the *margin of error* is \(0.03954\)).
Equivalently, the approximate \(95\)% CI is from \(0.130\) to \(0.209\), after rounding appropriately.
We write:

The sample proportion of female US college students who drink coffee daily is \(\hat{p} = 0.169\) (\(n = 360\)), with an approximate \(95\)% CI from \(0.130\) to \(0.209\).

That is, the plausible values for \(p\) that may have led to this value of \(\hat{p} = 0.1694\) are between \(0.130\) and \(0.209\).
(This CI may or may not contain the true proportion \(p\).)
This CI is *statistically* valid, since \(61\) in the sample drink coffee, and \(299\) do not (and both exceed five).

Many decimal places are used in the working, but final answers are rounded.

## 23.8 Chapter summary

To compute a confidence interval (CI) for a proportion, compute the sample proportion, \(\hat{p}\), and identify the sample size \(n\).
Then compute the standard error, which quantifies how much the value of \(\hat{p}\) varies across all possible samples:
\[
\text{s.e.}(\hat{p})
=
\sqrt{\frac{ \hat{p} \times (1-\hat{p})}{n}}.
\]
The *margin of error* is (multiplier\({}\times{}\)standard error), where the multiplier is \(2\) for an approximate \(95\)% CI (from the \(68\)--\(95\)--\(99.7\) rule).
Then the CI is:
\[
\hat{p} \pm \left( \text{Multiplier}\times\text{standard error} \right).
\]
The statistical validity conditions should also be checked.

You must use *proportions* in these formulas, **not** *percentages*; that is, use values between \(0\) and \(1\) (like \(0.169\) rather than \(16.9\)%).

## 23.9 Quick review questions

- True or false: \(p\) is a
*parameter*. - True or false: The value of \(p\) will vary from sample to sample.

- True or false: The
*standard error*refers to the sampling variation in \(p\).

- Suppose \(n = 50\) and \(\hat{p} = 0.4\). What is the standard error of \(\hat{p}\)?

## 23.10 Exercises

Answers to odd-numbered exercises are available in App. E.

**Exercise 23.1 **G.-W. Lee et al. (2016) found that, of \(864\) patients examined with hiccups, \(708\) were male.

- Compute the sample proportion of people with hiccups who are male.
- Find an approximate \(95\)% CI for the proportion of people with hiccups who are male.
- Check if the statistical validity conditions are met or not.
- Draw a sketch of how the sample proportion varies for samples of size \(864\).

**Exercise 23.2 **Lord, Cui, and Kelly (2009) studied how paramedics administer pain medication, and found that \(791\) of patients reporting pain did *not* receive pain relief, out of \(1\,766\) patients in the study who reported pain.

- Compute the sample proportion of patient who did not received pain medication.
- Find an approximate \(95\)% CI for the proportion of patients who did not receive pain medication.
- Check if the statistical validity conditions are met or not.
- Draw a sketch of how the sample proportion varies for samples of size \(1766\).

**Exercise 23.3 **Mann and Blotnicky (2017) studied the eating habits of university students in Canada.
They found that \(8\) students out of \(154\) met the recommendation for eating a sufficient number of servings of grains each day.

- Find an approximate \(95\)% CI for the population proportion of Canadian students that meet the recommendation for eating a sufficient number of servings of grains each day.
- Check if the statistical validity conditions are met or not.
- Draw a sketch of how the sample proportion varies for samples of size \(51\).
- Would these results be likely to apply to US university students? Explain.

**Exercise 23.4 **C. E. Dexter et al. (2018) found that \(18\) of the \(n = 51\) koalas studied in a certain area over \(30\) months had crossed at least one road during that time.
The unknown parameter is \(p\), the *population* proportion of koalas that had crossed at least one road over the \(30\) months.

- Find an approximate \(95\)% CI for the proportion of koalas that had crossed the road at least once.
- Check if the statistical validity conditions are met or not.
- Draw a sketch of how the sample proportion varies for samples of size \(51\).

**Exercise 23.5 **Sutherland et al. (2012) studied salt intake in the United Kingdom, and found that \(2\,182\) out of the \(6\,882\) people sampled in 2007 'generally added salt at the table'.
Find an approximate \(95\)% CI for the population proportion of Britons that generally add salt at the table.

**Exercise 23.6 **A study of turbine failures (Myers, Montgomery, and Vining 2002; Nelson 1982) ran \(42\) turbines for around \(3\ 000\) hours, and found that nine developed fissures (small cracks).
Find a \(95\)% CI for the true proportion of turbines that would develop fissures after \(3\ 000\) hours of use.
Are the statistical validity conditions satisfied?

The study also ran \(39\) turbines for around \(400\) hours, and found that zero developed fissures. Find a \(95\)% CI for the true proportion of turbines that would develop fissures after \(400\) hours of use. Are the statistical validity conditions satisfied?

**Exercise 23.7 **Hammond, Reid, and Zukowski (2018) studied young Canadians aged \(12\)--\(24\), and found \(365\) of the \(1\,516\) respondents reported sleeping difficulties after consuming energy drinks.
Find a \(95\)% CI for the true proportion of young Canadians who experience sleeping difficulties after consuming energy drinks.
Are the statistical validity conditions satisfied?