Confidence Intervals for a Proportion

A2 · S2 · 12 min

Opinion polls, quality checks and medical trials usually measure a proportion rather than a mean: the fraction of voters who support a policy, of components that are faulty, of patients who recover. A large random sample gives a sample proportion, and the same reasoning that produced confidence intervals for a mean turns it into an approximate confidence interval for the population proportion. On Paper 6 this appears as a short question or as one part of a longer one: calculate the interval, find a sample size for a required margin of error, recover the sample from an interval, or interpret the result.

The sample proportion

Suppose a proportion pp of a population has some property. A random sample of size nn is taken, and XX of the sampled members have the property. Then X∼B(n,p)X \sim B(n, p), and the sample proportion is

Ps=Xn.P_s = \frac{X}{n}.

Its mean and variance follow from the binomial:

E(Ps)=E(X)n=npn=p,Var(Ps)=Var(X)n2=np(1−p)n2=p(1−p)n.E(P_s) = \frac{E(X)}{n} = \frac{np}{n} = p, \qquad \text{Var}(P_s) = \frac{\text{Var}(X)}{n^2} = \frac{np(1 - p)}{n^2} = \frac{p(1 - p)}{n}.

So PsP_s is an unbiased estimator of pp. For large nn, the binomial is approximately normal (as in the normal approximation to the binomial), and therefore so is PsP_s.

Approximate distribution of a sample proportion

For a large random sample,

Ps∼N(p,p(1−p)n) approximately.P_s \sim N\left(p, \frac{p(1 - p)}{n}\right) \text{ approximately.}

This result is in the formula booklet.

Building the interval

Follow the same steps as for a mean. With probability about 0.950.95,

−1.96<Ps−pp(1−p)/n<1.96.-1.96 < \frac{P_s - p}{\sqrt{p(1 - p)/n}} < 1.96.

Rearranging would put pp in the middle, but pp also appears inside the square root, and pp is what we do not know. For a large sample, the observed proportion psp_s is close to pp, so it is used in its place to estimate the standard deviation. This is the second reason the interval is only approximate.

Approximate confidence interval for a proportion

If xx of a large random sample of size nn have the property, and ps=xnp_s = \dfrac{x}{n}, then an approximate confidence interval for pp is

ps−zps(1−ps)n<p<ps+zps(1−ps)np_s - z\sqrt{\frac{p_s(1 - p_s)}{n}} < p < p_s + z\sqrt{\frac{p_s(1 - p_s)}{n}}

with z=1.645,1.96,2.326,2.576z = 1.645, 1.96, 2.326, 2.576 for 90%,95%,98%,99%90\%, 95\%, 98\%, 99\%.

The margin of error is zps(1−ps)nz\sqrt{\dfrac{p_s(1 - p_s)}{n}}, half the width of the interval.

The interval is approximate for two reasons: the normal distribution only approximates the binomial, and psp_s is used in place of pp in the variance. Both errors shrink as nn grows, which is why the syllabus specifies a large sample. A useful check is that npsnp_s and n(1−ps)n(1 - p_s) should both be comfortably greater than 55.

There is no continuity correction in a confidence interval for a proportion. The correction is used when finding a probability for a single count, not here.

Confidence interval for a proportion
  1. Calculate ps=xnp_s = \dfrac{x}{n}, where nn is the sample size and xx the number with the property.
  2. Calculate ps(1−ps)n\sqrt{\dfrac{p_s(1 - p_s)}{n}} and keep at least 4 significant figures.
  3. Choose zz for the confidence level.
  4. Calculate the margin of error and write the interval (ps−margin, ps+margin)(p_s - \text{margin},\ p_s + \text{margin}) to 3 significant figures.
  5. If the question is about a number in a population of size NN, multiply both ends by NN.
Routine: a survey

In a random sample of 400400 residents of a town, 128128 say that they cycle to work. Find an approximate 95%95\% confidence interval for the proportion of all residents who cycle to work.

Solutionps=128400=0.32,0.32×0.68400=0.023324p_s = \frac{128}{400} = 0.32, \qquad \sqrt{\frac{0.32 \times 0.68}{400}} = 0.0233240.32±1.96×0.023324=0.32±0.045710.32 \pm 1.96 \times 0.023324 = 0.32 \pm 0.04571

The interval is (0.274,0.366)(0.274, 0.366).

A different confidence level

A quality check finds 1818 faulty items in a random sample of 300300 items from a production line. Find an approximate 99%99\% confidence interval for the proportion of faulty items produced.

Solutionps=18300=0.06,0.06×0.94300=0.013711p_s = \frac{18}{300} = 0.06, \qquad \sqrt{\frac{0.06 \times 0.94}{300}} = 0.0137110.06±2.576×0.013711=0.06±0.035320.06 \pm 2.576 \times 0.013711 = 0.06 \pm 0.03532

The interval is (0.0247,0.0953)(0.0247, 0.0953).

Check the size condition: nps=18np_s = 18 and n(1−ps)=282n(1 - p_s) = 282, both well above 55.

Choosing the sample size

Pollsters usually decide the margin of error first and then work out how many people to ask. Setting the margin of error equal to the target EE gives

zp(1−p)n≤E⇒n≥z2p(1−p)E2.z\sqrt{\frac{p(1 - p)}{n}} \le E \quad\Rightarrow\quad n \ge \frac{z^2 p(1 - p)}{E^2}.

This needs a value for pp before the survey is done. There are two choices.

  • Use an estimate of pp from a pilot survey or from past data.
  • If nothing is known, use p=0.5p = 0.5. The product p(1−p)p(1 - p) is largest when p=0.5p = 0.5, as the graph shows, so this gives the largest nn that could be needed: a safe answer whatever the true proportion.
y = x (1 - x) (0.5, 0) -- (0.5, 0.25)
How many people to ask

A poll is planned to estimate the proportion of voters who support a proposal, with an approximate 95%95\% confidence interval.

(a) Find the smallest sample size that guarantees a margin of error of at most 0.030.03, whatever the true proportion.

(b) Find the smallest sample size needed if it is known from past polls that the proportion is about 0.20.2.

Solution

(a) Use p=0.5p = 0.5, which gives the widest possible interval.

1.960.5×0.5n≤0.03  ⇒  n≥1.96×0.50.03=32.667  ⇒  n≥1067.11.96\sqrt{\frac{0.5 \times 0.5}{n}} \le 0.03 \;\Rightarrow\; \sqrt{n} \ge \frac{1.96 \times 0.5}{0.03} = 32.667 \;\Rightarrow\; n \ge 1067.1

The smallest sample size is 10681068.

(b) With p=0.2p = 0.2:

1.960.2×0.8n≤0.03  ⇒  n≥1.962×0.160.032=682.951.96\sqrt{\frac{0.2 \times 0.8}{n}} \le 0.03 \;\Rightarrow\; n \ge \frac{1.96^2 \times 0.16}{0.03^2} = 682.95

The smallest sample size is 683683. Prior knowledge that pp is far from 0.50.5 saves a lot of interviews.

Interpreting the interval

The interpretation is the same as for a mean. If many random samples were taken and an interval calculated from each in the same way, about 95%95\% of the intervals would contain the true proportion pp. A particular interval either contains pp or it does not.

A claimed value of pp that lies outside the interval is evidence against the claim at the corresponding level; a claimed value inside the interval is consistent with the data. Formal tests of a claimed proportion are covered in hypothesis tests for a binomial proportion.

Reading the sample from an interval

An approximate 90%90\% confidence interval for a population proportion, calculated from a random sample of 250250 people, is (0.353,0.455)(0.353, 0.455). Find the number of people in the sample who had the property.

Solution

The interval is centred on psp_s:

ps=0.353+0.4552=0.404.p_s = \frac{0.353 + 0.455}{2} = 0.404.

The number with the property is 0.404×250=1010.404 \times 250 = 101.

Check the half-width: 1.6450.404×0.596250=1.645×0.031034=0.05111.645\sqrt{\dfrac{0.404 \times 0.596}{250}} = 1.645 \times 0.031034 = 0.0511, which matches 0.455−0.404=0.0510.455 - 0.404 = 0.051.

Exam-hard: recovering the sample size and the level

An approximate 95%95\% confidence interval for the proportion of left-handed students in a large school is (0.18875,0.31125)(0.18875, 0.31125).

(a) Find the sample size and the number of left-handed students in the sample.

(b) From the same sample, an approximate α%\alpha\% confidence interval is calculated, and its width is 0.10.1. Find α\alpha.

(c) Comment on a claim that 15%15\% of the students in the school are left-handed.

Solution

(a) The centre gives ps=0.18875+0.311252=0.25p_s = \dfrac{0.18875 + 0.31125}{2} = 0.25, and the margin of error is 0.31125−0.25=0.061250.31125 - 0.25 = 0.06125.

1.960.25×0.75n=0.06125  ⇒  0.1875n=0.03125  ⇒  0.1875n=0.0009765625  ⇒  n=1921.96\sqrt{\frac{0.25 \times 0.75}{n}} = 0.06125 \;\Rightarrow\; \sqrt{\frac{0.1875}{n}} = 0.03125 \;\Rightarrow\; \frac{0.1875}{n} = 0.0009765625 \;\Rightarrow\; n = 192

The number of left-handed students is 0.25×192=480.25 \times 192 = 48.

(b) The margin of error is 0.050.05, so

z×0.03125=0.05  ⇒  z=1.6.z \times 0.03125 = 0.05 \;\Rightarrow\; z = 1.6.

Φ(1.6)=0.9452\Phi(1.6) = 0.9452, so each tail contains 0.05480.0548, and the level is 1−2(0.0548)=0.89041 - 2(0.0548) = 0.8904. So α=89.0\alpha = 89.0.

(c) 0.150.15 lies below the 95%95\% confidence interval, so the sample suggests the claim is wrong and that the proportion of left-handed students is greater than 15%15\%.

Common mistakes
  • Using the count instead of the proportion. ps=xnp_s = \dfrac{x}{n} is a number between 00 and 11. Putting x=128x = 128 into ps(1−ps)p_s(1 - p_s) gives nonsense.
  • Confusing the sample size with the count. In ps(1−ps)n\sqrt{\dfrac{p_s(1 - p_s)}{n}}, nn is the number sampled, not the number with the property.
  • Adding a continuity correction. Confidence intervals for proportions do not use one.
  • Using a one-tailed zz. 95%95\% needs 1.961.96, not 1.6451.645.
  • Rounding a sample size down. It must satisfy an inequality: always round up.
  • Using psp_s when the question gives a prior value for planning. In sample-size questions, use the value of pp stated in the question, or 0.50.5 if none is given and the answer must work for any pp.
  • Interpreting the interval as a probability statement about pp. pp is fixed; the 95%95\% describes the method.
Exam tip
  • Show psp_s, the expression ps(1−ps)n\sqrt{\dfrac{p_s(1 - p_s)}{n}} with numbers in, and the final interval. Each typically earns a mark.
  • Give the endpoints to 3 significant figures. Percentages are acceptable if the question uses them, but do not mix the two.
  • Questions often say "approximate" confidence interval. If asked why it is approximate, give either reason: a normal approximation to the binomial is used, or the sample proportion is used in place of the population proportion in the variance.
  • If asked for an interval for the number in a population of size NN, multiply the proportion interval by NN and round sensibly.
  • "Comment on the claim" questions: say whether the claimed value lies inside or outside the interval and what that suggests, in context. Avoid "proves".
Summary
  • ps=xnp_s = \dfrac{x}{n} is an unbiased estimate of the population proportion pp.
  • For large nn, Ps∼N(p,p(1−p)n)P_s \sim N\left(p, \dfrac{p(1 - p)}{n}\right) approximately.
  • Approximate confidence interval: ps±zps(1−ps)np_s \pm z\sqrt{\dfrac{p_s(1 - p_s)}{n}}.
  • Margin of error =zps(1−ps)n= z\sqrt{\dfrac{p_s(1 - p_s)}{n}}; the interval's centre is psp_s.
  • Sample size for margin EE: n≥z2p(1−p)E2n \ge \dfrac{z^2p(1 - p)}{E^2}, using p=0.5p = 0.5 if nothing is known.
  • The interval is approximate: normal approximation, and psp_s replaces pp.
  • No continuity correction. Round sample sizes up.

Practice questions

Question
  1. In a random sample of 150150 seeds, 4545 fail to germinate. Find an approximate 95%95\% confidence interval for the proportion of seeds that fail to germinate.
  2. In a random sample of 10001000 voters, 520520 support a proposal. Find an approximate 98%98\% confidence interval for the proportion of all voters who support it.
  3. A company wants an approximate 99%99\% confidence interval for the proportion of customers who are dissatisfied, with a margin of error of at most 0.050.05. Past surveys suggest the proportion is about 0.20.2. Find the smallest sample size needed.
  4. An approximate 95%95\% confidence interval for a proportion is (0.3608,0.4392)(0.3608, 0.4392). Find the sample size and the number in the sample with the property.
  5. Give two reasons why a confidence interval for a proportion calculated by the method in this note is only approximate.
  6. A town has 24 00024\,000 households. In a random sample of 500500 households, 8585 own a dog. Find an approximate 90%90\% confidence interval for the number of households in the town that own a dog.
  7. A newspaper claims that 40%40\% of the residents of a town cycle to work. A random sample of 400400 residents found that 128128 cycle to work. Use an approximate 95%95\% confidence interval to comment on the claim.
  8. A market researcher wants to estimate the proportion of people who would buy a new product. A pilot survey of 200200 randomly chosen people finds that 3030 would buy it. (a) Find an approximate 95%95\% confidence interval for the proportion, based on the pilot survey. (b) Using the pilot estimate, find the smallest total sample size that would give a 95%95\% confidence interval with a margin of error of at most 0.020.02. (c) Explain why the researcher might prefer to base the sample size on a proportion of 0.50.5 instead, and state the disadvantage of doing so.
Answers
  1. ps=0.3p_s = 0.3; 0.3×0.7150=0.037417\sqrt{\tfrac{0.3 \times 0.7}{150}} = 0.037417; 0.3±1.96×0.037417=0.3±0.07330.3 \pm 1.96 \times 0.037417 = 0.3 \pm 0.0733, giving (0.227,0.373)(0.227, 0.373).

  2. ps=0.52p_s = 0.52; 0.52×0.481000=0.015799\sqrt{\tfrac{0.52 \times 0.48}{1000}} = 0.015799; 0.52±2.326×0.015799=0.52±0.03670.52 \pm 2.326 \times 0.015799 = 0.52 \pm 0.0367, giving (0.483,0.557)(0.483, 0.557).

  3. 2.5760.2×0.8n≤0.05⇒n≥2.5762×0.160.052=424.72.576\sqrt{\tfrac{0.2 \times 0.8}{n}} \le 0.05 \Rightarrow n \ge \dfrac{2.576^2 \times 0.16}{0.05^2} = 424.7. The smallest sample size is 425425.

  4. Centre ps=0.4p_s = 0.4, margin 0.03920.0392. 1.960.4×0.6n=0.0392⇒0.24n=0.02⇒n=0.240.0004=6001.96\sqrt{\tfrac{0.4 \times 0.6}{n}} = 0.0392 \Rightarrow \sqrt{\tfrac{0.24}{n}} = 0.02 \Rightarrow n = \tfrac{0.24}{0.0004} = 600. The number with the property is 0.4×600=2400.4 \times 600 = 240.

  5. The normal distribution is used as an approximation to the binomial distribution of the number with the property. The sample proportion psp_s is used in place of the unknown population proportion pp in the variance p(1−p)n\tfrac{p(1 - p)}{n}.

  6. ps=85500=0.17p_s = \tfrac{85}{500} = 0.17; 0.17×0.83500=0.016799\sqrt{\tfrac{0.17 \times 0.83}{500}} = 0.016799; 0.17±1.645×0.016799=0.17±0.027630.17 \pm 1.645 \times 0.016799 = 0.17 \pm 0.02763, giving (0.14237,0.19763)(0.14237, 0.19763). Multiply by 24 00024\,000: approximately (3417,4743)(3417, 4743) households.

  7. ps=0.32p_s = 0.32 and the 95%95\% interval is (0.274,0.366)(0.274, 0.366) (see the first example). 0.400.40 lies above the interval, so the sample suggests the claim is wrong: the proportion who cycle to work appears to be less than 40%40\%.

  8. (a) ps=30200=0.15p_s = \tfrac{30}{200} = 0.15; 0.15×0.85200=0.025249\sqrt{\tfrac{0.15 \times 0.85}{200}} = 0.025249; 0.15±1.96×0.025249=0.15±0.04950.15 \pm 1.96 \times 0.025249 = 0.15 \pm 0.0495, giving (0.101,0.199)(0.101, 0.199) to 3 s.f. (b) 1.960.15×0.85n≤0.02⇒n≥1.962×0.12750.022=1224.51.96\sqrt{\tfrac{0.15 \times 0.85}{n}} \le 0.02 \Rightarrow n \ge \dfrac{1.96^2 \times 0.1275}{0.02^2} = 1224.5, so 12251225 people. (c) The pilot estimate is itself uncertain (its interval reaches nearly 0.20.2). If the true proportion is closer to 0.50.5, 12251225 people would not achieve the required margin. Using 0.50.5 guarantees the margin whatever the proportion. The disadvantage is cost: it needs n≥1.962×0.250.022=2401n \ge \dfrac{1.96^2 \times 0.25}{0.02^2} = 2401, almost twice as many people.

How well do you know this?

Builds on

Where this leads

Console

Search notes, courses and tools, or run an action