A brief note on Fair Ways to Choose a Sample . Read it before a test. Try each question at the end before you open its answer.
The four methods Simple random: every group of n n n is equally likely. Each member has the chance n N \dfrac{n}{N} N n . In Python: random.sample(frame, n). Systematic: step k = N n k = \dfrac{N}{n} k = n N , a random start, then every k k k th member. Beware of a pattern in the list. Stratified: a simple random sample inside each stratum. Proportional allocation: n × N i N n \times \dfrac{N_i}{N} n × N N i places for stratum i i i . Cluster: whole groups chosen at random, everyone in them asked. Cheap, but less precise when clusters are alike. The sampling frame The frame is the list you choose from. People missing from it can never be chosen. The margin of luck Quick rule: margin ≈ 100 n \approx \dfrac{100}{\sqrt n} ≈ n 100 percentage points, for about 95 polls in 100. Sample size: n = ( 100 m ) 2 n = \left(\dfrac{100}{m}\right)^2 n = ( m 100 ) 2 for a margin m m m . Halving the margin needs four times the sample. The margin covers luck only, never bias. A worked example A college has 600 science students and 400 arts students. It wants a stratified sample of 50.
Science places. 50 × 600 1000 = 30 50 \times \dfrac{600}{1000} = 30 50 × 1000 600 = 30 . Arts places. 50 × 400 1000 = 20 50 \times \dfrac{400}{1000} = 20 50 × 1000 400 = 20 . The margin for the whole sample. About 100 50 ≈ 14.1 \dfrac{100}{\sqrt{50}} \approx 14.1 50 100 ≈ 14.1 points, so a sample of 50 gives only a rough answer. Practice with new numbers
A program to try The program shares the places of the worked example and finds the margin.
Run it. Do the places add up to 50?
1. Change sample = 50 to sample = 200. What happens to the margin?
Mistakes to avoid Strata or clusters? Strata: some from every group. Clusters: all from some groups. Repeats. random.choices can repeat a member. Use random.sample. Unweighted strata. Equal samples from unequal strata must be weighted. Check yourself A list of 750 names needs a systematic sample of 25. What is the step? Stuck? Show a hint Show the answerFind the margin of luck of a fair poll of 400. Stuck? Show a hint Show the answerA firm picks 5 of its 60 offices at random and asks every worker in them. Which method is this? Stuck? Show a hint Show the answerHow many people give a margin of 10 percentage points? Stuck? Show a hint Show the answerSources OpenStax, Introductory Statistics , Chapter 1, section on data, sampling and variation, and Chapter 8, on confidence intervals for a proportion.