This is a note for the book Population Genetics: A Concise Guide (Second Edition).
Page 25
Problem 2.3 Convince yourself that the average time for the population to become homozyggous is , in fact, two generations.
Note:
The model is discussed here is a single hermaphroditic A1A2 heterozygote individual, wich means: (1) the population is kept constant at 1, when it reproduces by mating at random. (2) In each generation, the probabilities of homozygote and heterozygote are both 0.5 (A1A1: 0.25, A1A2: 0.5, A2A2: 0.25). So this turns to a geometric distribution question, similiar to “how many coin flips until you get a head”. (A proof can be found here: How many coin flips until you get a head?)
We can also write a program to simulate the process:
package de.yanzhou.demo;
import java.util.IntSummaryStatistics;
import java.util.stream.IntStream;
public class TestFunction {
private static int test() {
int i = 0;
double n = 0d;
while (n < 0.5) {
n = Math.random();
i++;
}
return i;
}
public static void main(String[] args) {
IntSummaryStatistics stats = IntStream.range(0, 10000)
.map(i -> test())
.summaryStatistics();
System.out.println(stats);
}
}
Output:
IntSummaryStatistics{count=10000, sum=20031, min=1, average=2,003100, max=16}
This indicated that by 10000 of simulations, the minimal time for the population to become homozyggous is 1, while the maximal time could be 16. The average time is approximately equal to 2.