Population Genetics Practical 6: Neutral expectations and stochastic realizations
Learning objectives
Explain neutral allele-copy sampling; calculate its conditional mean and variance; compare small finite populations; distinguish expected heterozygosity loss from an individual trajectory; and interpret fixation, loss and effective population size carefully.
Continue from Practical 5 and the slides on random genetic drift. Use base R. All simulations are small, seeded teaching experiments; they are not estimates for a species or a broad calibration study.
1. Define a neutral Wright–Fisher model
Take a fixed population of \(N\) diploid individuals, hence \(2N\) allele copies. Generations do not overlap. The next generation’s copies are sampled independently with replacement from a neutral parental pool at A frequency \(p_t\):
There is no mutation, migration or selection. This single-locus model does not generate chromosome inheritance, pedigrees, sex roles or individual phenotypes. It is an allele-count sampling model, not a complete breeding population.
Question 1. If the expected frequency stays 0.25, why is the next realized frequency not necessarily 0.25?
Suggested answer
Expectation averages possible samples. With four copies, realized frequencies lie on 0, 0.25, 0.5, 0.75 and 1. The expected value is a mean over possible outcomes, not a guaranteed realization. A neutral trajectory can rise, fall or reach a boundary.
local({ old <-par(mfrow=c(1,2)); on.exit(par(old))for(j inseq_along(sizes)) {matplot(0:generations,trajectories[[j]],type="l",lty=1,col=adjustcolor("#247BA0",alpha.f=.45),ylim=c(0,1),xlab="Generation",ylab="A frequency",main=paste("N =",sizes[j]))abline(h=.5,lty=2,col="#B65C39") }})
Figure 1: Twenty seeded neutral trajectories for each model size, starting at A frequency 0.5.
Question 2. Why do smaller populations fluctuate more strongly? Is the average of these 20 runs guaranteed to equal 0.5 at every step?
Suggested answer
The conditional variance scales as \(1/(2N)\). A finite average of simulated trajectories also has sampling variation, so it is not guaranteed to equal the theoretical expectation. The two panels are illustrations of that model, not evidence about a real population’s demographic history.
4. Track gene diversity
For the random-union diversity \(H_t=2p_t(1-p_t)\),
Figure 2: Mean gene diversity of the toy trajectories versus the exact neutral expectation; a finite mean need not lie on the theoretical curve.
Question 3. Must gene diversity decline at every step of every trajectory?
Suggested answer
No. A frequency moving toward 0.5 increases gene diversity in that realization. The decline applies to the expectation over neutral sampling, not a monotone constraint on each path.
5. Interpret fixation and loss
Without mutation or migration, frequencies 0 and 1 are absorbing. For this finite neutral model, eventual fixation probability of A is its initial frequency. Reaching fixation by a specified short horizon is a different quantity; runs still segregating at that horizon must not be counted as losses.
Show R code
outcomes <-t(vapply(trajectories,function(z) { final <- z[nrow(z),]c(A_lost=sum(final==0),A_fixed=sum(final==1),segregating=sum(final>0& final<1))},numeric(3)))rownames(outcomes) <-paste0("N=",sizes)knitr::kable(outcomes)
In this ideal model \(N\) specifies the sampling variance. A real population’s census size need not equal the effective size governing drift. Unequal reproductive success, sex ratios, overlapping generations and demographic changes can alter the relevant effective size. Its estimation needs a named method and sampling assumptions; these toy trajectories do not estimate it.
Exercises
Compare conditional variance at \(p=0.5\) for \(N=25\) and \(N=250\).
Calculate expected gene diversity after 60 generations at those sizes.
Start a neutral model at fixation. Explain which omitted processes could restore a missing allele.
The smaller model has ten times the conditional sampling variance. Mutation can introduce an allele and migration can bring it from another pool; neither is present in the neutral recursion. A boundary outcome in this model does not imply permanent loss from every real population.
App and package connections
The existing drift Shiny app is an optional local interface with its existing dependencies; this practical does not change or qualify the app. gpop owns population expectations and estimators, while biological population simulation belongs in gsim. The base-R sampler here is a one-locus teaching illustration, not a new package primitive.
Next, Practical 7 adds genotype fitness and compares deterministic selection with finite-population sampling.