About this site
Chance and Selection is a free interactive explanation of population genetics: how gene variants become common or rare, and why. It is part of a public library of interactive explanations. It has no ads and needs no sign-up.
What is on this site§
Six chapters build one model, a single gene with two alleles in a population of diploid organisms, and switch on one evolutionary force at a time: none (Hardy–Weinberg), selection, drift, founder events and bottlenecks, migration, and finally selection and drift together. Every chapter tests the model against real measurements: MN blood-group counts for 216 human populations (Mourant and colleagues, 1976, via the HardyWeinberg package), Peter Buri’s 1956 counts for 107 fruit-fly populations (via the popgenr package), Michael Majerus’s peppered moth series as analysed by Cook and colleagues (2012), and genome data for northern elephant seals (Hoelzel and colleagues, 2024).
The beetles are a drawing convention, not a species: each one’s two wing cases show its two copies of the gene. Vermilion is always allele A and blue always allele a.
How the science is checked§
Every simulation draws exact binomial samples (no normal approximation) from a seeded random-number generator, so any figure can be shared and reproduced in its exact state. The model code is tested against worked examples, against the exact Wright–Fisher Markov chain, and against the closed-form results of Wright, Haldane and Kimura (more than sixty tests). An independent test suite is written from the published equations and reference values without reading the model’s code. Every factual claim is recorded in a claims register with its source and checked by a reviewer who did not write it. What each figure simplifies is stated next to the figure and collected on the sources page.
Found an error?§
Please open an issue on the source repository. Corrections are welcome and are credited.
Reuse§
Text and figures are licensed CC BY 4.0; code is MIT. Teachers may use and adapt any of it, with attribution. The data sets remain under their original licences (the R packages HardyWeinberg and popgenr; Cook et al. 2012 is CC BY).