A sampling simulator. Students survey an imaginary campus of 10,000 students, choosing who to ask (a random sample or a convenience sample) and how many (25 to 1,600). Every survey adds a dot to a chart, so students can see sampling error, why bigger samples help less and less, and why a large biased sample is still wrong. By Gwen Sharp.
Live site: https://gsharpokie.github.io/samplingsim/
- Who do you ask? A random sample, or whoever is in the library on a Friday night.
- How many? 25, 100, 400, or 1,600 students.
- Run the survey once or 50 times. Each result is a dot on a 0–100% scale. Random samples are circles and library samples are squares.
- The true answer stays hidden until the student selects “Show the true answer,” so they first have to decide how much to trust their own results.
- Things to try: four short experiments. What you’re seeing explains sampling error, margin of error, convenience samples, and the 1936 Literary Digest poll, followed by discussion questions.
- Everything is simulated in the student’s browser. Each student gets different dots, which makes comparing results part of the lesson. Nothing is saved or sent anywhere.
- The campus is invented: 38% of all students work 20+ hours a week, and 21% of students in the library on Friday night do.
Open index.html on GitHub, select the pencil icon, and near the top of the <script> section change:
TRUE_P = 0.38(the true share) andLIB_P = 0.21(the share in the convenience sample),SIZES = [25, 100, 400, 1600](the sample sizes offered).
The wording of the scenario (campus, jobs, library) is plain text in the page and can be edited the same way.
Go to Settings → Pages. Under Build and deployment, set Source to Deploy from a branch, choose the main branch and the / (root) folder, and select Save. Keep Issues turned on so the “Suggest a correction” link works.
Squire, Peverill. 1988. “Why the 1936 Literary Digest Poll Failed.” Public Opinion Quarterly 52(1): 125–133.
This site aims to meet WCAG 2.1 Level AA, so it works for people who use screen readers, keyboards, or screen magnification.
- All buttons, sliders, and links can be reached and used with a keyboard, and show a visible outline when selected.
- Charts have text descriptions, and many also have a data table or a slider that reads out each value.
- Text meets WCAG AA color contrast standards.
- Pages fit narrow phone screens without sideways scrolling.
I checked it in November 2026 with automated accessibility testing (axe-core) plus keyboard and small-screen checks. It hasn’t yet been tested by people who use screen readers every day, so there may be problems I haven’t caught. If something doesn’t work for you, please let me know.
Created by Gwen Sharp (@gsharpokie).
© 2026 Gwen Sharp. Licensed under CC BY-NC 4.0: you may share and adapt it for noncommercial purposes with credit. See LICENSE.