Presets
Playback
Population genetics
Bottleneck
Island biogeography
Run
Layers
Model check
The science
What is simulated
Six islands receive colonists from a mainland. On every island a population of N diploid individuals carries one gene with four alleles (red, gold, green, cyan). Each generation the allele frequencies are changed deterministically by selection, mutation and migration and then resampled by chance: 2Ne gene copies are drawn from the new frequencies (Wright-Fisher model). The same islands also hold up to 40 mainland species that arrive and die out at random (MacArthur-Wilson model). Island size and distance come from the map.
Genetic drift (Wright-Fisher)
Sampling 2Ne copies from frequency p gives a binomial draw with variance Var(p') = p(1-p) / 2Ne. Averaged over many populations the heterozygosity therefore decays as E[Ht] = H0 (1 - 1/2Ne)t ~ H0 e-t/2Ne. A neutral allele is fixed with probability equal to its starting frequency, P(fix) = p0. Both facts are tested live below. Inbreeding with coefficient F reduces the effective size, Ne = N / (1 + F) (Wright).
Bottleneck
If the population size varies, the long-run drift rate is set by the harmonic mean of the sizes, 1/Ne = (1/T) sum 1/Nt, so a few generations at N = 5 destroy much more diversity than many generations at N = 200 can restore. After the bottleneck the survivors refill the island, so the alleles that were lost stay lost unless gene flow or mutation brings them back.
Selection, mutation, migration
Per generation, before sampling: selection on the red allele p' = p(1+s) / (1 + s p); mutation among K = 4 alleles pi' = pi(1-mu) + (1-pi) mu/(K-1); migration pi' = (1-m) pi + m psource,i. Mutation against drift settles near H* ~ 4 Ne mu / (1 + 4 Ne mu) (infinite-alleles approximation). With migration, FST ~ 1 / (1 + 4 N m): one migrant per generation (N m = 1) is enough to keep islands similar.
Diversity indices
Shannon index H' = - sum pi ln pi (maximum ln K = 1.386 for four equal alleles); expected heterozygosity (Nei gene diversity) He = 1 - sum pi2; the Hill number exp(H') is the equivalent number of equally common alleles. The same Shannon formula is applied to the abundances of the species present on an island (abundances are a fixed log-normal set, not measured data).
Hardy-Weinberg
With random mating the genotype frequencies are p2, 2pq, q2. The panel samples individuals of the inspected island, compares observed counts with the expected ones using chi2 = sum (O - E)2 / E (1 degree of freedom: 3 classes, 1 estimated frequency; 3.84 is the 5 % limit), and estimates F = 1 - Ho/He. With F > 0 a fraction F of individuals receive two copies of the same gene, so heterozygotes are missing.
Island biogeography
Each of the P = 40 mainland species is either present or absent on an island. An absent species arrives with probability l = i0 exp(-d / 100 km) per year, a present one disappears with probability e = e0 A-z (A = relative island area). This two-state chain has the exact equilibrium richness S* = P l / (l + e): far and small islands carry fewer species, near and large ones more. A species-area relation S ~ Az' emerges from the area dependence of extinction.
Honest simplifications
One locus, four alleles, discrete non-overlapping generations, no recombination, no sex ratio, no spatial structure inside an island, additive haploid-style selection, and F is applied as an effective-size correction only. The species model has independent species (no competition, no extinction debt), and all rates are illustrative, not fitted to a real archipelago. The replicate lineages are isolated (no migration) and follow the size schedule of island 1. Nothing here predicts a real conservation outcome; it shows the mechanisms.
Things to try
1. Preset Neutral drift, small islands: small islands lose alleles first. 2. Bottleneck and recovery: diversity collapses at generation 25 and does not return. 3. Gene flow rescues diversity: raise m from 0 to 0.05 and watch He recover. 4. Inbreeding lowers Ne: the estimated F in the readout follows the slider. 5. Remote small islands: richness equilibrates far below the mainland pool. 6. Move the start frequency of the replicate lines: the share of lineages that end fixed for the red allele equals that frequency.