Learn R Programming

coala (version 0.4.0)

feat_migration: Feature: Migration/Gene Flow

Description

This feature changes the migration rates at a given time point. Per default, no migration between the population occurs, which corresponds to a rate of 0. Set it to a value greater than zero to enable migration from one population to another.

Usage

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

Arguments

rate
The migration rate. Can be a numeric or a parameter. The rate is specified as $4 * N0 * m$, where $m$ is the fraction of pop_to that is replaced by migrants from pop_from each generation (in forward time).
pop_from
The population from which the individuals leave.
pop_to
The population to which the individuals move.
symmetric
Use the rate for all pairs of populations.
time
The time point at which the migration with the migration rate is set. The rate applies to the time past warts of the time point, until it is changed again.

Details

When looking forward in time, a fraction of pop_to that is replaced by migrants from pop_from each generation (see rate). When looking backwards in time, ancestral lines in pop_to move to pop_from with the given rate.

See Also

Other features: feat_growth, feat_ignore_singletons, feat_mutation, feat_outgroup, feat_pop_merge, feat_recombination, feat_selection, feat_size_change, feat_unphased

Examples

Run this code
# Asymmetric migration between two populations:
model <- coal_model(c(5, 5), 10) +
  feat_migration(0.5, 1, 2) +
  feat_migration(1.0, 2, 1) +
  feat_mutation(5) +
  sumstat_sfs()
simulate(model)

# Three populations that exchange migrations with equal
# rates at times more than 0.5 time units in the past:
model <- coal_model(c(3, 4, 5), 2) +
  feat_migration(1.2, symmetric = TRUE, time = 0.5) +
  feat_mutation(5) +
  sumstat_sfs()
simulate(model)

Run the code above in your browser using DataLab