Exercise 2
Exercise 2¶
For our in class exercise you programmed a little function to compute the allele frequency in the next generation, \(p'\), due to natural selection. I’d like you to use this function to explore the sojourn time of a selected mutation in the population. The sojourn time is the amount of time it takes for the allele to go from some initial frequency, \(p_0\), to frequency 1 (fixation) in a population.
For this exercise, make a plot of sojourn time as a function of the selection coefficient \(s\) for perhaps 100 values of \(s\) from between zero and one, with a starting frequency \(p_0 = 0.001\).