Learn R Programming

coala (version 0.7.2)

feat_size_change: Feature: Instantaneous Size Change

Description

This feature changes the effective population size of one population. The change is performed at a given time point and applies to the time interval further on into the past from this point. The population size is set to a fraction of N0.

Usage

feat_size_change(new_size, population = 1, time = "0", locus_group = "all")

Value

The feature, which can be added to a model using +.

The feature, which can be added to a model created with coal_model using +.

Arguments

new_size

A parameter giving the new size of the population, as a fraction of N0.

population

The number of the population whichs size changes. Can also be set to "all". Then the size changes applies to all populations.

time

The time at which the population's size is changed.

locus_group

The loci for which this features is used. Can either be "all" (default), in which case the feature is used for simulating all loci, or a numeric vector. In the latter case, the feature is only used for the loci added in locus_ commands with the corresponding index starting from 1 in order in which the commands where added to the model. For example, if a model has locus_single(10) + locus_averaged(10, 11) + locus_single(12) and this argument is c(2, 3), than the feature is used for all but the first locus (that is locus 2 - 12).

See Also

For continuous size changes over time: feat_growth.

For creating a model: coal_model

Other features: feat_growth(), feat_ignore_singletons(), feat_migration(), feat_mutation(), feat_outgroup(), feat_pop_merge(), feat_recombination(), feat_selection(), feat_unphased()

Examples

Run this code
# A model with one smaller population:
model <- coal_model(c(20, 5), 3) +
  feat_size_change(.1, population = 2) +
  feat_mutation(1.0) +
  feat_migration(0.5, 2, 1) +
  sumstat_sfs()
simulate(model)

# A model of one population that experienced a bottleneck:
model <- coal_model(10, 1) +
  feat_size_change(0.1, time = 0.3) +
  feat_size_change(1.0, time = 0.5) +
  feat_mutation(20) +
  sumstat_sfs()
simulate(model)

Run the code above in your browser using DataLab