Polling Simulator: How Do Polls Work?
A hands-on educational simulator of modern political polls. Generate a synthetic 50,000-voter electorate with realistic correlated demographics, draw a biased ~1,000-respondent sample, and then experiment with raking/weighting to see how closely the weighted sample recovers the population truth.
How the simulator works
- Generate a synthetic electorate. 50,000 voters with correlated demographics (age, education, race, sex, region) and derived attributes (party ID, vote choice, turnout propensity). Benchmarks come from real Census and Pew data.
- Draw a biased sample. Each simulation generates a fresh non-response profile, so some demographics are over-represented and others under-represented.
- Apply raking. Iterative proportional fitting adjusts sample weights to match the true demographic targets.
- Inspect the fallout. See the effective sample size, the design effect, and the margin of error change as you toggle which demographics are used as weighting targets.
Pedagogical points
- Raking on more dimensions reduces bias but increases variance — the design effect goes up, and the effective sample size goes down.
- Weighting on party ID is controversial: it stabilizes estimates against partisan non-response, but it bakes in assumptions about the partisan composition of the electorate.
- Non-sampling error is the dominant source of real-world poll error — larger than what the reported margin of error captures.
Related projects
By G. Elliott Morris, author of Strength In Numbers: How Polls Work and Why We Need Them (W.W. Norton).