Each dot is a simulated person, assigned exposed/unexposed at the chosen prevalence, then diseased/healthy with risk = baseline risk (unexposed) or baseline × true relative risk (exposed), capped at 98%. This population is the ground truth — nobody doing a real study gets to see it directly.
A cohort study fixes sample size by exposure status: it draws n exposed and n unexposed people and follows them forward to see who develops disease. It measures incidence directly, so it can compute a true relative risk:
RR = [a/(a+b)] / [c/(c+d)]
a = exposed & diseased b = exposed & healthy
c = unexposed & diseased d = unexposed & healthy
A case-control study fixes sample size by disease status instead: it draws n cases (diseased) and n controls (healthy) and looks backward at their exposure history. It cannot measure incidence — only the odds of prior exposure — so it computes an odds ratio:
OR = (a × d) / (b × c)
When disease is rare (baseline risk well under ~10%), the odds ratio is a close approximation of the relative risk — the "rare disease assumption". Push the baseline risk slider up and re-sample in both designs: the case-control OR increasingly overstates the true RR as disease becomes common, because odds diverge from risk once probabilities move away from zero. This is the classic textbook argument for why case-control studies suit rare diseases and cohort studies suit common ones.
The chart below the population view plots the true value against every sample you draw (per study design), so you can see how much a single estimate wobbles around the truth from sampling variability alone — draw several samples at the same settings and watch the dots scatter around the dashed true-value line.
- Regenerate population — redraws the whole underlying population from the current sliders and clears the sampling history.
- Cohort / Case-Control — switches which fixed margin the sample uses; each design keeps its own history.
- Draw new sample — takes a fresh random sample of the chosen size and design from the same population, so you can see sampling variability.
- Drag / scroll on the population view — pan and zoom; a large population is easier to inspect zoomed in.