## Interact box Coalescent events in two demes

A coalescent genealogy that includes the possibility of migration among demes can be constructed using the cumulative exponential distribution specified by equation 4.70 to determine the waiting time to an event. Once the waiting time is obtained, then determining whether each event is a migration or a coalescence can be accomplished with equations 4.72 or 4.73. If the event is coalescence, a random pair of lineages in a random deme is picked to coalesce and the number of ancestral lineages in that deme (k) is reduced by 1. If the event is migration, a random lineage is picked and moved into a random deme. It is possible to construct a coalescent genealogy that includes the possibility of mutations occurring along each branch.

A natural way to see the results of these steps is to simulate genealogies in a simple case with two demes. Using the link on the text web page, go to the BiRC Animators web page and click on the Migration link under the heading Hudson Animator. This will take you to a web page containing a Java simulation. There are three parameters that can be set in the simulation: n: sets the number of lineages sampled in both demes in the present time (or k1 + k2 in equation 4.71), while M1: and M2: set the expected number of migrants in deme 1 and deme 2 each time period (or M in equations 4.68 and 4.70). Pressing Recalc will calculate the waiting times for a new genealogy. The animation process can be controlled with the buttons below the figure. Waiting times can be seen in at the lower right when the pointer is placed over a circle in the tree. Click on the Trees tab at the top left to see how population structure impacts the genealogical tree itself.

Initially set n to 10 and both M1 and M2 to the low migration rate of 0.1. Simulate 10 independent trees, in each case recording the number of migration events (the light blue circles in the animation) and the total waiting time until coalescence to a single most recent common ancestor. Increase both M1 and M2 to a higher migration rate of 1.0 and again simulate 10 independent trees and record the number of migration events and total waiting time to an MRCA. How do the genealogies compare on average when migration rates are lower or higher?

Figure 4.17 Sample configurations for two lineages and two demes (a) and three lineages and three demes (b). Lineages are represented by the circles and the separation between demes is represented by a dotted vertical line. Only one possibility is given for each sample configuration even though some configurations can occur in multiple ways. For example, (0,1) can occur when both lineages are in the left-hand deme or when both lineages are in the right-hand deme.

within and among demes. We can define a list (or row vector) that tracks the way lineages are partitioned among all demes as

## Post a comment