Learn R Programming

coalescentMCMC (version 0.4-4)

sim.coalescent: Coalescent Simulation and Visualisation

Description

This is a pedagogic function to show what is the coalescent in a simple population model with discrete generations and asexual reproduction.

Usage

sim.coalescent(n = 5, TIME = 50, growth.rate = NULL, N.0 = 50, N.final = 20,
               col.lin = "grey", col.coal = "blue", pch = NULL, ...)

Arguments

n

the sample size.

TIME

the number of generations.

growth.rate

the growth rate of the population.

N.0

the initial size of the population.

N.final

the final size of the population (i.e., at present).

col.lin

the colour used to show links of ancestry in the population.

col.coal

the colour used to show the coalescent of the \(n\) individuals.

pch

the symbol used to show individuals (none by default).

further arguments passed to points if pch is used.

Details

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).

References

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.

Examples

Run this code
# NOT RUN {
sim.coalescent()
sim.coalescent(N.0 = 20) # constant population size
# }

Run the code above in your browser using DataLab