Natural Selection Simulator
Model how natural selection against a recessive phenotype shifts allele frequency generation by generation, using q(t+1) = q(1−sq)/(1−sq²), where s is the selection coefficient against the recessive homozygote. Two 3D diagrams compare a slowly-declining allele under weak selection to a rapidly-declining one under strong selection, and charts trace allele frequency across many generations.
Reviewed by the ToolNestr Editorial Team — July 2026
Weak vs. strong selection
1. Weak selection
The recessive allele (amber) remains fairly common even after many generations.
2. Strong selection
The recessive allele becomes rare much faster under strong selection pressure.
Allele frequency over time
How it works
The core idea in one line: selection can only act on individuals it can actually see — and a recessive allele hiding inside heterozygous carriers is invisible to selection, which is exactly why a rare harmful recessive trait can survive selection pressure for far longer than intuition suggests.
q(t+1) = q(1−sq) / (1−sq²)
recessive allele frequency next generation, under selection against the recessive (qq) genotype
s = 0: no selection; s = 1: fully lethal/non-reproductive recessive genotype
selection coefficient range
When selection acts against a recessive phenotype, only homozygous recessive individuals (qq) are actually disadvantaged — heterozygous carriers (Aa) show the normal dominant phenotype and reproduce completely normally despite carrying the recessive allele. The recursive formula q(t+1) = q(1−sq)/(1−sq²) captures this generation by generation: it removes recessive alleles from the qq individuals each generation but leaves every copy hiding in Aa carriers completely untouched. As q shrinks, an ever-larger share of the remaining recessive alleles sit protected inside those carriers, which is exactly why the rate of decline slows dramatically once the allele becomes rare — no matter how strong the selection coefficient against the visible homozygotes actually is.
Worked example 1 — moderate selection against a recessive trait
Given: Starting recessive allele frequency q0 = 0.5, with a selection coefficient s = 0.5 against the recessive genotype.
Even with substantial selection pressure (s=0.5), the allele frequency drops noticeably slower each generation as it becomes rarer — selection against homozygotes gets weaker in effect as fewer of them exist to select against.
Worked example 2 — a fully lethal recessive allele (s=1)
Given: Starting recessive allele frequency q0 = 0.5, with complete selection (s=1) against the recessive genotype — every aa individual fails to reproduce.
This counterintuitively slow decline is a well-known result in population genetics — it explains why even severe recessive genetic diseases rarely disappear quickly from a population through selection alone.
Selection coefficient vs. speed of allele frequency decline
Starting from q0=0.5 in all cases, showing frequency after 20 generations.
| Selection coefficient (s) | q after 20 generations |
|---|---|
| 0.1 (weak selection) | ≈0.31 |
| 0.5 (moderate selection) ★ | ≈0.093 |
| 1.0 (complete/lethal selection) | ≈0.045 |
★ Reference row (worked example 1). Stronger selection accelerates the decline, but the rate of decline always slows down as the allele becomes rarer, regardless of how strong s is.
Where natural selection modeling actually matters
🦟 Pesticide and antibiotic resistance evolution
The same selection-coefficient math describes how quickly a resistance allele spreads (positive selection) or a susceptibility allele declines when pesticide or antibiotic pressure is applied to a population.
🧬 Genetic disease population modeling
Population geneticists use this model to predict how quickly (or how slowly) a harmful recessive allele's frequency might change under different selection pressures, informing genetic counseling and public health projections.
🐛 Industrial melanism (peppered moths)
The classic case of dark-colored peppered moths increasing in frequency during industrial pollution (better camouflage against soot-darkened trees) is a textbook real-world example of selection changing allele frequency over generations.
🌾 Agricultural pest and weed management
Farmers and agronomists model how quickly a herbicide- or pesticide-resistance allele might decline once a chemical is no longer used, informing crop rotation and resistance management strategies.
Common misconceptions
"Natural selection can always eliminate a harmful recessive allele quickly."
Selection against a recessive allele slows dramatically as the allele becomes rare, since most remaining copies hide inside unaffected heterozygous carriers — even strong, sustained selection can take many, many generations to substantially reduce a rare recessive allele's frequency.
"A selection coefficient of 1 means the allele disappears in one generation."
Even complete selection against the homozygous recessive genotype (s=1) only removes the qq individuals each generation — the allele itself persists in heterozygous carriers and declines gradually rather than vanishing immediately.
"Natural selection only acts on rare, harmful alleles."
Selection can act on alleles at any frequency and can favor as well as disfavor a trait — this model specifically describes selection against a recessive phenotype, but analogous models exist for selection favoring a dominant allele, heterozygote advantage, and other selection patterns.
"This model perfectly predicts real allele frequency trajectories."
This is a simplified, idealized model — it doesn't account for genetic drift, migration, mutation, changing environments, or interactions between multiple genes, all of which influence real allele frequency trajectories.
Formula sources & further reading
The formulas here are standard, traceable to:
- • OpenStax, Biology 2e — Chapter 20, "Evolution" (free, peer-reviewed). openstax.org
- • Hartl & Clark, Principles of Population Genetics — Selection theory chapter.
- • Futuyma & Kirkpatrick, Evolution — Natural selection and allele frequency change chapter.
q(t+1)=q(1−sq)/(1−sq²), iterated generation by generation. A discrete-generation, random-mating idealized model. Results are rounded for display.
How to use this calculator
Enter starting allele frequency
The recessive allele's frequency (q0) at the start of the simulation.
Enter the selection coefficient
How strongly selection acts against the recessive genotype, from 0 (none) to 1 (fully lethal).
Enter number of generations
The recessive allele frequency after that many generations solves instantly.
Related tools
Frequently asked questions
What is a selection coefficient?
The selection coefficient (s) measures how strongly selection acts against a genotype, ranging from 0 (no disadvantage) to 1 (fully lethal or non-reproductive) — a genotype with fitness (1−s) reproduces less successfully than genotypes with full fitness.
How does selection against a recessive homozygote change allele frequency each generation?
Using q(t+1) = q(1−sq) / (1−sq²), where q is the recessive allele frequency this generation and s is the selection coefficient against the recessive (qq) genotype.
Why does selection against a rare recessive allele act so slowly?
Once a recessive allele becomes rare, most copies of it are 'hidden' inside heterozygous carriers, who show the dominant phenotype and aren't affected by selection at all — this is exactly why eliminating a rare deleterious recessive allele from a population takes a very long time.
What happens with complete selection against a lethal recessive (s=1)?
The math simplifies to q(t+1) = q/(1+q), producing a much slower decline than intuition might suggest — even a fully lethal recessive allele can persist in a population for many generations once it becomes rare, since it keeps hiding in heterozygous carriers.
Does natural selection ever completely eliminate an allele?
Selection against a recessive allele approaches zero asymptotically but technically never reaches exactly zero in this idealized model — in real populations, genetic drift, mutation, or a heterozygote advantage can also keep an allele present indefinitely at low frequency.