Genetic Drift Calculator

Model allele frequency shifts from random sampling quickly. Estimate variance, heterozygosity, and fixation chances today. Run simulations, export results, and compare scenarios effortlessly now.

Calculator
Set your parameters
3 columns on large, 2 on medium, 1 on small.
Use a value between 0 and 1.
Finite Ne controls drift strength.
Capped at 2000 for performance.
Higher counts stabilize percentiles.
Same seed repeats results.
Tip: Smaller Ne and larger t increase drift dispersion and fixation rates.
Example data table
Use these sample settings to test outputs and downloads.
Scenario p0 Ne t Simulations Expected Ht trend
Small population drift 0.50 50 40 300 Fast decline
Moderate drift 0.30 500 80 500 Gradual decline
Large population stability 0.10 5000 120 600 Slow decline
Formula used
This calculator uses a neutral Wright-Fisher drift model with effective size Ne.
Heterozygosity decay
Starting heterozygosity is H0 = 2p0(1 - p0).
Expected heterozygosity after t generations: Ht = H0(1 - 1/(2Ne))^t.
Allele-frequency variance
With neutrality, E[p_t] = p0.
Approximation: Var(p_t) approx p0(1 - p0)[1 - (1 - 1/(2Ne))^t], and SD(p_t) = sqrt(Var(p_t)).
Simulation step (Wright-Fisher sampling)
Each generation samples: K ~ Binomial(2Ne, p), then p' = K/(2Ne). Fixation occurs at p = 1, and loss at p = 0.
How to use this calculator
  1. Enter p0 as the starting allele frequency.
  2. Set Ne to represent drift strength in your population.
  3. Choose generations to project drift over time.
  4. Pick simulations for stable percentiles and rates.
  5. Submit to see results above the form.
  6. Export with CSV or PDF for reports.

Drift strength scales with effective size

Random sampling error grows as Ne decreases. With p0=0.50, Ne=50, and t=40, simulated endpoints spread widely, and fixation events become common. When Ne rises to 5000, the same t keeps most endpoints near p0, reflecting tighter sampling variance.

Variance connects math and outcomes

The calculator reports Var(p_t) ≈ p0(1-p0)[1-(1-1/(2Ne))^t]. For p0=0.40, Ne=500, t=50, the drift factor (1-1/(2Ne))^t stays close to 0.951, so variance remains modest and SD(p_t) stays small, matching the histogram width.

Heterozygosity declines predictably

Expected heterozygosity starts at H0=2p0(1-p0). The projected value Ht=H0(1-1/(2Ne))^t shrinks each generation, which is why long time horizons amplify drift effects. In practical runs, Ht falls faster in small populations even when p0 is identical.

Fixation and loss rates are interpretable

Under neutrality, the fixation probability equals p0 and the loss probability equals 1-p0. The simulation rates approach these values as simulations increase, while finite t limits full absorption. The displayed fixation and loss rates quantify how often endpoints hit 1 or 0 within t generations.

Trajectories show path dependence

The Plotly line chart visualizes one run, where early fluctuations can lock in later outcomes. A run that drifts to p=0.80 at gen 10 has fewer steps to reach fixation than one drifting to p=0.20. This path dependence is central to stochastic dynamics.

Scenario comparison supports planning

Use consistent p0 while sweeping Ne and t to compare stability. For reporting, export CSV for auditing and PDF for sharing. Percentiles (P05, P50, P95) summarize uncertainty, and the final distribution plot clarifies whether outcomes cluster, bifurcate, or approach absorption.

FAQs

1) What does Ne represent here?

Ne is the effective population size used in Wright-Fisher sampling. Smaller Ne increases random sampling error per generation, widening the final frequency distribution and increasing fixation or loss within the same time horizon.

2) Why do theory and simulation differ slightly?

Theory values are expectations and approximations, while simulations are finite samples. With low simulation counts or short t, sampling noise can shift percentiles and endpoint rates. Increase simulations for more stable estimates.

3) How should I choose the number of simulations?

Use 200 to quickly explore scenarios. Use 500–2000 when you need stable percentiles and endpoint rates. Higher counts reduce Monte Carlo error and make the histogram smoother.

4) What does the histogram plot show?

It shows the distribution of final allele frequencies after t generations across all simulations. Narrow histograms indicate weak drift, while wide or spiky histograms suggest strong drift or frequent absorption at 0 or 1.

5) Can I reproduce the same results?

Yes. Enter a random seed. Using the same inputs and seed produces the same random sequence, so results, plots, and exports repeat consistently for documentation or comparison.

6) Is selection included in this model?

No. This calculator assumes neutrality. If selection is present, fixation probabilities and trajectories change. You can still use it as a baseline to understand pure drift before adding other evolutionary forces.

Related Calculators

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.