Skip to main content
Biology

Genetic Drift Simulation: Hardy-Weinberg & Flow

Run island populations for 50 generations. When does chance beat selection, and when do islands become new species?

Under Hardy-Weinberg equilibrium (random mating, no selection, no migration, no mutation, very large N), a dominant allele at p = 0.20 stays at 20.0% across 10 generations (p^2 = 0.04 AA, 2pq = 0.32 Aa, q^2 = 0.64 aa; 36.0% dark birds), whereas finite island populations undergo random genetic drift that erodes heterozygosity H_t = H_0*(1 - 1/(2N))^t far faster on 10-bird islets (H_50 = 0.038) than on 500-bird islets (H_50 = 0.476). In this 3D genetic drift simulation, students run Hardy-Weinberg chi-square tests, trigger storm bottlenecks (N = 4) and founder islets, and compare connected vs. isolated twin islands over 200 generations.

  • 11 languages
  • Laptop · tablet · phone
  • Members

Create a free account to get 2 lifetime Free Lab Passes for any labs in the library. The course guide on this page stays free.

Inside this lab

  1. 1

    Preview

    • Driving question
    • What you will predict
    • Equipment and safety
  2. 2

    Lab

    • Lock in prediction
    • Run the experiment, measure and replay
    • Your notebook fills in as you go
  3. 3

    Check

    • Did the lab agree with you?
    • Claim, evidence, reasoning
    • Check questions and a printable lab report

Hardy-Weinberg equation, genetic drift, and gene flow

Use this population genetics simulation and Hardy-Weinberg simulation to separate null equilibrium from the mechanisms that shift allele frequencies (p for dominant dark-feather allele A, q = 1 - p for recessive light allele a):

  • Hardy-Weinberg equilibrium: p + q = 1 and p^2 + 2pq + q^2 = 1. Test observed bird samples (n = 50, 200, or all 2,000) with chi^2 = sum((O - E)^2 / E), df = 1, critical value 3.84 (p = 0.05; requires every expected count E >= 5).
  • Expected heterozygosity decay under drift: H_t = H_0 * (1 - 1 / (2N))^t (starting at p_0 = 0.5, H_0 = 0.500).
  • Expected drift variance of p: Var(p_t) = p_0 * (1 - p_0) * (1 - (1 - 1 / (2N))^t).
  • Twin-island neutral divergence (20 loci): D = mean(|p_1 - p_2|) averaged across 20 independent loci on two 50-bird islands.
Evolutionary Force in LabStation & SettingEffect on Within-Population Diversity (H)Effect on Between-Island Difference (D)
Hardy-Weinberg nullMainland (N = 2,000, s = 0)Constant (2pq unchanged in Ideal)None
Genetic driftIslets (N = 10 vs. 500, 50 gens)Erodes H rapidly in small N (0.500 -> 0.038 at N = 10)Increases divergence among isolated islets
Bottleneck / FounderIslets (Storm -> 4 survivors; Found -> 4 colonists)Sharp drop in H; lost alleles cannot return without gene flowInstant shift in allele frequency by sampling chance
Gene flow (Migration)Twin East pair (m = 0.02, sandbar) vs. West (m = 0)Replenishes lost alleles between linked islandsSuppresses D compared with isolated west pair
Directional selectionMainland / Islets (s = +0.10 favoring A) or Twin divergent food (+/-0.10 at locus 0)Drives favored allele toward fixation (can still lose to drift at N = 10)Divergent food increases divergence at selected locus

Apparatus, safety notes, and step-by-step procedure

  • Apparatus: 3D archipelago with three stations: (1) Mainland (N = 2,000 birds, adjustable p_0 = 0.1–0.9, Selection None / +10%, 10 generations, genotype sampler for 50, 200, or All, and Hardy-Weinberg chi-square calculator); (2) Islets (8 islands, 50 generations from p_0 = 0.5, presets A: 4x10 + 4x500, B: 8x50, C: 4x25 + 4x100, Selection None / +10%, Storm bottleneck to 4 survivors, and Found a new islet from 4 birds growing to 50); (3) Twin islands (E1/E2 sandbar-linked m = 0.02 vs. W1/W2 channel-isolated m = 0, N = 50, 20 neutral loci, 100 -> 200 generations, Same vs. Different food, plus illustrative prezygotic/postzygotic barrier scenes); and Inside: gene pool binomial draw visualizer.
  • Safety note: This is a computer population simulation with no live animals handled; real field biologists obtain permits and follow wildlife ethics protocols before banding or sampling birds.
  1. Watch the Opening mainland flock (p_0 = 0.20 dominant dark allele A, 36.0% dark birds, random mating, no selection) and lock your 10-generation prediction before pressing Continue.
  2. Open Investigate -> Mainland in Ideal mode, set Start A to 0.60 (Selection = None), run 10 generations, and press Sample to verify exact Hardy-Weinberg counts (AA = 720, Aa = 960, aa = 320, chi^2 = 0.00).
  3. Switch to Real mode on Mainland, sample 200 birds (with Selection = None and then +10%), and evaluate chi^2 (df = 1, critical 3.84), noting why failing to reject does not prove zero evolution.
  4. Switch to Investigate -> Islets, lock your 4 x 10 vs. 4 x 500 drift prediction, select Preset A (4x10 + 4x500) with Selection = None, run 50 generations, and press Measure now to compare mean |p - 0.5|, heterozygosity H, and fixed/lost alleles across tiny vs. large islets.
  5. Start a new Islets run and trigger a Storm (4 survive) bottleneck on a large 500-bird islet mid-run, or click Found a new islet (4 founders growing to 50), then open Inside: gene pool to inspect parental genotypes and the 2N random allele draw into the next generation.
  6. Toggle Selection (+10%) on Preset A across several Real-mode seeds to test when random drift on 10-bird islets overpowers +10% selection and eliminates A.
  7. Switch to Investigate -> Twin islands, lock your East vs. West isolation prediction, run 100 generations (then continue to 200), and press Measure now to compare D_linked (east sandbar) vs. D_iso (west channel).
  8. Compare the Prezygotic (different songs) and Postzygotic (sterile hybrids) barrier scenarios, noting that neutral-locus D measures genetic divergence rather than reproductive compatibility.

Recording table and model reference data

Model reference data — run your own trials in the 3D lab. Values below reflect analytical Hardy-Weinberg and Wright-Fisher drift expectations built directly into model.ts (p_0 = 0.20 opening; p_0 = 0.50, H_0 = 0.500 on islets).

TrialIndependent Variable (Population Size & Condition)Dependent Variable (Exact Model Expectation)UnitsObservation
Ref 1Mainland Ideal (p_0 = 0.20, s = 0, 10 gens)p = 0.200, AA = 0.04, Aa = 0.32, aa = 0.64 (36.0% dark)frequency (0–1), %Dominance never raises p under Hardy-Weinberg equilibrium
Ref 2Mainland Ideal (p_0 = 0.60, s = 0, N = 2,000)720 AA, 960 Aa, 320 aa (chi^2 = 0.00, df = 1)birds, chi^2Matches p^2 = 0.36, 2pq = 0.48, q^2 = 0.16 exactly
Ref 3Islets analytical drift (p_0 = 0.50, t = 50 gens): N = 10 vs. N = 500H_50 = 0.038 (Var = 0.2308) vs. H_50 = 0.476 (Var = 0.0122)heterozygosity H, varianceSmall islets lose 92% of expected heterozygosity in 50 generations
Ref 4Twin islands (N = 50, 20 loci, 100–200 gens): East (m = 0.02) vs. West (m = 0)D_iso > D_linked across repeated runs (1 migrant/gen mixes East)mean |p_1 - p_2|Gene flow prevents neutral divergence; geographic barrier allows drift apart
Your TrialRecord station, mode/seed, N or preset, s, and generationRecord AA/Aa/aa, chi^2, p, H, or D_linked vs. D_isocounts, 0–1, chi^2Compare chi^2 against 3.84 (df = 1) only when all expected counts >= 5

Lab report outline (blank template)

  1. Title: State the evolutionary genetics hypothesis tested (Hardy-Weinberg equilibrium, population-size drift, bottleneck/founder effect, or gene flow).
  2. Purpose: Define how genotype sampling, heterozygosity tracking, and multi-locus island divergence test equilibrium vs. drift and migration.
  3. Hypothesis: Predict how p behaves under random mating with no selection, how N = 10 vs. 500 alters drift after 50 generations, and how a sandbar vs. deep channel alters D.
  4. Variables: Identify starting p_0, population size N, selection s, bottleneck/founder events, and migration m (independent); genotype counts, p, H, fixation count, chi^2, and D (dependent); non-overlapping generations, zero mutation, and 20 twin-island loci (controlled).
  5. Data Table: Log Mainland AA/Aa/aa counts and chi^2, Islet per-island final p, H, and fixation status, and Twin-island D_linked vs. D_iso at generations 100 and 200.
  6. Analysis & Calculation: Compute p = (2*AA + Aa) / (2n), expected counts n*p^2, n*2pq, n*q^2, chi^2 (df = 1), and compare observed mean H_50 against 0.5 * (1 - 1/(2N))^50.
  7. Conclusion & Sources of Error: Explain when random drift beats selection, distinguish prezygotic vs. postzygotic barriers from neutral divergence D, and discuss stochastic Real-mode run-to-run variation (including rare runs where a large islet shifts more by chance).

Compare directional selection on adaptive traits in Beaks of Finches, review Mendelian segregation ratios in Genetic Crosses, apply chi-square inference to behavioral counts in Animal Behavior: Choice Chamber, or browse Biology Simulations.

Common questions

What are the Hardy-Weinberg equations and the five equilibrium conditions?

The allele-frequency equation is p + q = 1 and the genotype-frequency equation is p^2 + 2pq + q^2 = 1, where p and q are allele frequencies (A and a) and p^2, 2pq, and q^2 are AA, Aa, and aa frequencies. Equilibrium requires a very large population, random mating, no natural selection, no migration (gene flow), and no mutation.

Why does a dominant allele (A) starting at 20% not take over the mainland flock?

Dominance controls phenotype (both AA and Aa birds have dark feathers), not transmission probability during meiosis. With random mating, no selection, and a large population, each parent passes A or a with equal chance, keeping p fixed at 0.20 generation after generation.

Why do 10-bird islets lose alleles or reach fixation much faster than 500-bird islets?

Each generation draws 2N allele copies randomly from the parental gene pool. Drawing only 20 gene copies (N = 10) produces wide binomial sampling swings that quickly push p to 0 or 1, whereas drawing 1,000 copies (N = 500) keeps allele frequencies tightly clustered near 0.50.

How do a population bottleneck and a founder effect differ in the Islets station?

A bottleneck occurs when a storm slashes an existing islet down to 4 random survivors in place, erasing alleles that happened not to survive. A founder effect occurs when 4 random birds colonize a brand-new empty islet from the p = 0.5 source pool and then expand to 50 birds carrying only the founders' allele sample.

How does gene flow affect divergence between the east and west twin-island pairs?

On the sandbar-linked east pair (m = 0.02, about 1 migrant per 50-bird island each generation), gene flow continually mixes allele pools and keeps the 20-locus mean difference D small. On the channel-isolated west pair (m = 0), independent drift drives D much higher over 100 to 200 generations.

Why does the Hardy-Weinberg chi-square test use 1 degree of freedom instead of 2?

Although there are 3 genotype classes (AA, Aa, aa), the total sample size fixes one constraint and estimating p from those same observed counts uses a second constraint, leaving df = 3 - 1 - 1 = 1 (critical value 3.84 at p = 0.05).