Learn R Programming

coala (version 0.1.1)

feat_migration: Add migration/gene flow between two populations to a demographic model

Description

This function adds the assumption to the model that some individuals 'migrate' from one sub-population to another, i.e. they leave the one and become a member of the other. This is usually used to model ongoing gene flow through hybridisation after the populations separated.

Usage

feat_migration(rate, pop_from = NULL, pop_to = NULL, symmetric = FALSE,
  time = "0")

Arguments

rate
Instead of creating a new parameter, you can also set the mutation rate to an expression based on existing parameters. For example setting this to "M" will use an parameter with name M that you have previously created. You can also use R expression here,
pop_from
The population from which the individuals leave.
pop_to
The population to which the individuals move.
symmetric
Use the rate between all pairs of populations.
time
The time point at which the migration with this rate starts.

Details

You can enter a time (time) at which the migration is assumed to start (looking backwards in time). From that time on, a fixed number of migrants move from population pop_from to population pop_to each generation. This number is given via this feature's parameter, which equals 4*N0*m, where m is the fraction of pop_tothat is replaced with migrants each generation. If pop_to has also size Ne, than this is just the expected number of individuals that migrate each generation.

You can add different mutation rates at different times to your model. Then each rate will be used for the period from its time point to the next. Migration from and to an population always ends with the speciation event in which the population is created.

Examples

Run this code
# Asymmetric migration for two populations
model <- coal_model(c(25,25), 100) +
  feat_migration(0.5, 1, 2) +
  feat_migration(0.75, 2, 1)

# Symmetric Migration
model <- coal_model(c(25,25), 100) +
  feat_migration(par_range('m', 0.1, 2), symmetric=TRUE)

Run the code above in your browser using DataLab