This is a pedagogic function to show what is the coalescent in a simple population model with discrete generations and asexual reproduction.
sim.coalescent(n = 5, TIME = 50, growth.rate = NULL, N.0 = 50, N.final = 20,
col.lin = "grey", col.coal = "blue", pch = NULL, ...)
the sample size.
the number of generations.
the growth rate of the population.
the initial size of the population.
the final size of the population (i.e., at present).
the colour used to show links of ancestry in the population.
the colour used to show the coalescent of the \(n\) individuals.
the symbol used to show individuals (none by default).
further arguments passed to points
if pch
is used.
The simulation works along the following steps. The number of individuals at each generation is calculated. For each individual, a (unique) parent is randomly chosen at the previous generation. All individuals are then plotted and the ancestry lines are shown; the individuals are eventually ordered to avoid line-crossings. A sample of \(n\) individuals are randomly chosen from the last generation, and their shared ancestry is shown with thicker lines.
The first (oldest) generation is at the bottom, and the final (present) one is at the top of the plot.
The population size at each generation is determined from the four
arguments: TIME
, growth.rate
, N.0
, and
N.final
. At least three of them must be given by the user. If
TIME
is not given, its value is calculated with
log(N.final/N.0) / growth.rate
.
This code was used to make the figures in Emerson et al. (2001).
Emerson, B., Paradis, E. and Thebaud, C. (2001). Revealing the demographic histories of species using DNA sequences. Trends in Ecology and Evolution, 16, 707--716.
# NOT RUN {
sim.coalescent()
sim.coalescent(N.0 = 20) # constant population size
# }
Run the code above in your browser using DataLab