Population Genetics Drift Simulator

Follow reproducible Wright–Fisher allele-frequency paths and compare fixation, loss, and remaining variation across repeated populations.

Population setup

One neutral allele, one diploid population size, and many independent repeats.

Planned allele-copy draws640,000limit 5,000,000

Allele-frequency paths

Expected p = p₀

Fixed at p = 1
Lost at p = 0
Not absorbed by T
Mean final p
Expected H at T
Mean simulated H at T
Mean absorption generation

Formula, substitution, and precision

At every generation, the Wright–Fisher transition samples the next allele count and divides it by the available gene copies: Xₜ₊₁ ~ Binomial(2Ne, pₜ); pₜ₊₁ = Xₜ₊₁ ÷ (2Ne).

Before sampling, these moments describe the range of possible next generations: E[Xₜ₊₁] = 2Ne·pₜ; Var(Xₜ₊₁) = 2Ne·pₜ(1 − pₜ); Var(pₜ₊₁) = pₜ(1 − pₜ) ÷ (2Ne).

The expected share of unlike allele pairs declines across t generations as follows: H₀ = 2p₀(1 − p₀); Hₜ = H₀(1 − 1 ÷ (2Ne))ᵗ.

Every binomial draw uses exact Bernoulli sampling; no normal approximation is used. Calculations keep JavaScript double precision. Frequencies lie on increments of 1 ÷ (2Ne); the display rounds to at most six decimal places.

Method, assumptions, and limits

This page implements the neutral diploid Wright–Fisher model described by Nature Education and the Stanford Human Genetics text. Each new generation is a random sample of 2Ne allele copies from the previous one. Sources checked 6 August 2026.

Nature Education drift and effective size referenceStanford Human Genetics drift chapter

Change the population scenario or run this seeded example again.

Your parameters and simulated populations stay in this browser.

FAQ

Should I enter census size or effective population size?

Enter effective population size, Ne: the size of an idealized breeding population that would drift at the same rate as the population you mean to study. Census size can be much larger when sex ratios, reproductive success, population fluctuations, or population structure are uneven.

Is the neutral probability of eventual fixation equal to the starting frequency?

Yes, in this neutral model with no mutation or migration, an allele starting at frequency p₀ has eventual fixation probability p₀ and loss probability 1 − p₀. The rates shown above cover only the entered number of generations and repetitions, so they will vary with the seed.

Why can mean allele frequency stay near p₀ while heterozygosity falls?

Neutral drift has no preferred direction across many independent populations, so the average frequency remains p₀ in expectation. Individual populations spread toward 0 or 1, however, and both boundaries have zero heterozygosity. Variation is therefore lost even while the cross-population mean stays nearly unchanged.

Can this predict what a real population will do?

No. It shows outcomes under a deliberately idealized neutral Wright–Fisher model. Real predictions require defensible estimates of effective size and any selection, mutation, migration, changing population size, overlapping generations, linkage, and population structure that matter to the case.

The Wright–Fisher Model of Genetic Drift

The Population Genetics Drift Simulator is a tool designed to simulate and visualize neutral genetic drift using the diploid Wright–Fisher model. By setting up a simulated breeding population, users can follow and compare reproducible allele-frequency paths across multiple independent populations to see how genetic variation is lost or fixed over generations. The tool helps users understand how random sampling influences allele frequencies over time, showing simulated heterozygosity, fixation, and loss rates.

At every generation, the Wright–Fisher transition samples the next allele count and divides it by the available gene copies:

Xₜ₊₁ ~ Binomial(2Ne, pₜ); pₜ₊₁ = Xₜ₊₁ ÷ (2Ne)

Before sampling, these moments describe the range of possible next generations:

E[Xₜ₊₁] = 2Ne·pₜ; Var(Xₜ₊₁) = 2Ne·pₜ(1 − pₜ); Var(pₜ₊₁) = pₜ(1 − pₜ) ÷ (2Ne)

The expected share of unlike allele pairs declines across t generations as follows:

H₀ = 2p₀(1 − p₀); Hₜ = H₀(1 − 1 ÷ (2Ne))ᵗ

Each new generation is a random sample of 2Ne allele copies from the previous one. Every binomial draw uses exact Bernoulli sampling instead of a normal approximation. Calculations are kept in JavaScript double precision, and frequencies lie on increments of 1 ÷ (2Ne), with the interface display rounding values to a maximum of six decimal places.

Effective vs. Census Population Size

When setting up a simulation, users must input the effective population size, Ne, in the "breeding individuals" field. This parameter represents the size of an idealized breeding population that would drift at the same rate as the population under study.

The effective population size is distinct from the census population size. In real-world populations, the census size is often much larger than the effective size. This discrepancy occurs because factors such as uneven sex ratios, high variance in reproductive success, historical population fluctuations, and complex population structures reduce the genetic contribution of individuals, causing the population to lose genetic diversity at a rate equivalent to a much smaller, idealized population.

The Dynamics of Fixation and Loss

In a neutral model with no mutation or migration, an allele starting at frequency p₀ has an eventual fixation probability equal to p₀, and an eventual loss probability equal to 1 − p₀. Because the simulation runs over a finite number of generations, many populations may not reach these absorbing boundaries within the specified timeframe.

Once an allele frequency reaches 0 or 1, it enters an absorbing state. Without mutation to introduce new variation or migration to bring in alleles from other populations, a trajectory that reaches either boundary cannot leave it. The simulator tracks these outcomes and displays the following summary statistics:

  • Fixed at p = 1
  • Lost at p = 0
  • Not absorbed by T
  • Mean final p
  • Mean absorption generation (which displays "not reached" if absorption does not occur)

Heterozygosity and Genetic Diversity

Heterozygosity (H) represents the proportion of individuals in a population that carry two different alleles at a specific locus. In a finite population, random genetic drift causes heterozygosity to decay over time. The simulator calculates and compares two key metrics at the final generation (T):

  • Expected H at T
  • Mean simulated H at T

This decay illustrates the "paradox of the mean" in population genetics. While the average allele frequency across many independent populations remains stable and close to the starting frequency (Expected p = p₀), individual populations are drifting toward complete fixation (p = 1) or complete loss (p = 0). Because both of these absorbing boundaries have a heterozygosity of zero, the overall genetic variation within individual populations is lost over time, even though the cross-population mean allele frequency remains nearly unchanged.

Simulator Inputs and Workload Limits

To run a simulation, users configure the parameters in the "Population setup" interface:

Parameter Interface Label Valid Range / Constraints
Scenarios (Presets) Scenarios Small population, Large population, Rare allele
Effective population size Effective population size, Ne Whole number from 1 to 100,000 breeding individuals
Starting allele frequency Starting allele frequency, p₀ Proportion from 0 to 1 (inclusive of both boundaries)
Generations Generations Whole number from 1 to 2,000 generations
Independent populations Independent populations Whole number from 1 to 200 replicates
Random seed Random seed Text field up to 100 characters (with a "New seed" button)

To maintain browser performance, the simulator enforces a workload limit of 5,000,000 planned allele-copy draws, calculated as:

2Ne × generations × replicates

If this product is exceeded, the simulation blocks execution and displays an error message.

Method, Assumptions, and Limits

This tool implements the neutral diploid Wright–Fisher model described by Nature Education and the Stanford Human Genetics text.

The model relies on several strict assumptions:

  • Constant effective population size
  • Discrete, non-overlapping generations
  • Random, independent sampling of gametes
  • Selective neutrality (no natural selection)
  • One unlinked, two-allele locus
  • No mutation or migration

Because of these assumptions, the simulator does not predict real-world evolutionary outcomes. It should not be used as a forecast when selection, changing population size, sex-ratio or reproductive-success imbalances, overlapping generations, inbreeding, linkage, gene flow, or population structure are present. Additionally, an engineering safety factor does not apply to this stochastic biological model.

All parameters and simulated populations are processed locally and stay entirely within the user's browser. No data leaves the user's device.

Frequently Asked Questions

Should I enter census size or effective population size? Enter effective population size, Ne: the size of an idealized breeding population that would drift at the same rate as the population you mean to study. Census size can be much larger when sex ratios, reproductive success, population fluctuations, or population structure are uneven.

Is the neutral probability of eventual fixation equal to the starting frequency? Yes, in this neutral model with no mutation or migration, an allele starting at frequency p₀ has eventual fixation probability p₀ and loss probability 1 − p₀. The rates shown above cover only the entered number of generations and repetitions, so they will vary with the seed.

Why can mean allele frequency stay near p₀ while heterozygosity falls? Neutral drift has no preferred direction across many independent populations, so the average frequency remains p₀ in expectation. Individual populations spread toward 0 or 1, however, and both boundaries have zero heterozygosity. Variation is therefore lost even while the cross-population mean stays nearly unchanged.

Can this predict what a real population will do? No. It shows outcomes under a deliberately idealized neutral Wright–Fisher model. Real predictions require defensible estimates of effective size and any selection, mutation, migration, changing population size, overlapping generations, linkage, and population structure that matter to the case.