feat_growth: Feature: Exponential population size growth/decline

View source: R/feature_growth.R

feat_growthR Documentation

Feature: Exponential population size growth/decline

Description

This feature changes the growth factor of a population at given point in time. This factor applies to the time interval further into the past from this point.

Usage

feat_growth(rate, population = "all", time = "0", locus_group = "all")

Arguments

rate

The growth rate. Can be a numeric or a parameter. See Details for an explanation how the rate affects the population size.

population

The population which growths/declines. Can be "all" for all populations, or the number of one population.

time

The time at which the growth rate is changed. Can also be a parameter.

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

Details

The population size changes by a factor exp(-α*t), where α is the growth parameter and t is the time since the growth has started. For positive alpha, the population will decline backwards in time or grow forwards in time. For a negative value of α it will decline (forward in time).

Value

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

See Also

For instantaneous population size changes: feat_size_change

For creating a model: coal_model

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

Examples

# Simulate a haploid population that has been expanding for
# the last 2*Ne generations
model <- coal_model(10, 1) +
  feat_growth(5, time = 0) +
  feat_growth(0, time = 1) +
  feat_mutation(10) +
  sumstat_sfs()
simulate(model)

coala documentation built on Jan. 5, 2023, 5:11 p.m.