The interval for a proportion · Statistics & Data… | StemPy Lab
Course 6.2·Lesson 2 of 3
The interval for a proportion
The 95% confidence interval for a proportion is p^±1.96np^(1−p^)
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
find a 95% confidence interval for a proportion;
check the three conditions before you use it;
work out the sample size needed for a given margin of error.
The formula
Put the pieces of the last lesson together. The 95% confidence interval for a proportion is
p^±1.96np^(1−p^).
A made-up survey asks 400 students, chosen at random, how they come to school, and 92 say they walk. Then
Estimate.p^=40092=0.23.
Standard error.4000.23×0.77≈0.0210.
Margin.1.96×0.0210≈0.041.
Interval. From about 0.189 to about 0.271.
So we are 95% confident that between about 19% and 27% of all the students walk.
Three conditions
The formula leans on the normal curve and on the standard error rule. Both need conditions.
Random. The data come from a random sample, or from a randomised experiment. No formula can repair a biased sample.
Large enough. There are at least 10 successes and at least 10 failures in the sample. Then the sample shares are close to a normal curve.
Independent. The sample is less than about a tenth of the population, so that one choice hardly changes the next.
A survey of 150 people in which only 6 own a kite fails the second condition. The sample shares of such a survey are skewed, and the interval would be misleading. Some books use 5 in place of 10 in the second condition.
How many to ask
Before a survey, choose the margin m you want. Then solve 1.96np^(1−p^)≤m for n:
n≥(m1.96)2p^(1−p^).
You do not know p^ yet. Use a guess from an earlier study, or use 0.5, which gives the largest value of p^(1−p^) and so the safest n. For a margin of 3 points with no guess, n≥(0.031.96)2×0.25≈1067.1. So ask 1068 people. This is why so many national polls ask about a thousand people.
A graph of the margin of error at the 95 percent level against the sample size, from 0 to 2000 people. Two falling curves are drawn, a solid one for an expected share of 0.5 and a dashed one for 0.2. Both fall steeply at first and then level off, and the dashed curve lies below the solid one.
The picture shows the margin of error against the sample size for two expected shares. Both curves fall steeply at first and then slowly. Halving the margin always takes four times the sample.
Practise with new numbers
Try it in Python
The program checks the conditions and then gives the interval for three made-up surveys.
Common mistakes
Skipping the conditions. Check random, at least 10 successes and 10 failures, and less than a tenth of the population.
Rounding the sample size down. A sample must be a whole number of people, and rounding down gives too large a margin.
Using the margin of the whole sample for a small group in it. A group of 100 inside a survey of 1000 has a much larger margin.
Remember these
The interval is p^±1.96np^(1−p^).
Conditions: a random sample, at least 10 successes and 10 failures, a sample under a tenth of the population.
Sample size: n≥(m1.96)2p^(1−p^), with p^=0.5 when nothing is known.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
A made-up survey of 200 people finds 50 who cycle to work. Find the 95% interval for the share of cyclists, to three decimal places.
A survey of 80 people finds 7 who own an electric car. Can the formula be used?
With no guess for the share, how many people must you ask for a margin of 5 points?
A team wants to halve its margin of error. By what factor must it multiply its sample size?
A random sample of 500 is taken from a club of 2000 members. Which condition is in doubt?
References
OpenStax, Introductory Statistics, Chapter 8, section on a population proportion, including the sample size needed.
Enroll free in Confidence Intervals for Proportions and Means
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.
. It can be trusted only when its conditions hold: a random sample, enough successes and failures, and a sample that is a small part of the population. The same formula, turned around, tells you how many people to ask.
about 25 min1 simulation1 practice question1 Python program5 questions to check yourself
This lesson is free to read. Enroll free to keep your place and take the tests.