View source: R/sim_population.R
sim_population | R Documentation |
Simulate a single population through time and sample a transect for each generation.
sim_population(
mean_dispersal_distance,
outcrossing_rate,
n_generations,
n_starting_genotypes,
density,
n_sample_points,
sample_spacing,
dormancy,
range_limit = 1.5,
pop_structure = "uniform",
mixing = mean_dispersal_distance,
habitat_labels = NULL,
var_w = 0
)
mean_dispersal_distance |
Float >0. Mean seed dispersal distance. The reciprocal of this is used as the rate parameter to draw from the exponential distribution. |
outcrossing_rate |
Float between 0 and 1. Probability that an individual is outcrossed. |
n_generations |
Int >12. Number of generations to run the simulations. |
n_starting_genotypes |
Int >0. Number of initial genotypes to start with. Defaults to 50 |
density |
Float >0. Average density of plants per square metre. |
n_sample_points |
Number of points to sample along the transect. |
sample_spacing |
Distance between sampling points. |
dormancy |
Float between 0 and 1. Probability that a seedling is drawn from the seed bank. Seedlings are drawn from the prior generation with probability 1-dormancy. |
range_limit |
Float >1 defining how much wider than the transect the
width of the habitat should be. This, along with plant density, determines
how many plants will be simulated. Defaults to 1.5. Ignored if
|
pop_structure |
Character string indicating the initial population
structure to be simulated. Passing "uniform" simulated a panmictic population.
'clusters' simulates clusters of identical individuals that disperse from
distinct mothers via exponential dispersal set by
|
mixing |
Float >0. Parameter controlling the degree of spatial
clustering of genotypes. Smaller values indicate more structure populations.
If |
var_w |
Additive variance for (log) fitness. Defaults to zero (no selection). |
sim_population
simulates a population of annuals dispersing in continuous
space following exponentially distributed seed dispersal distances.
Individuals are drawn from a set of starting genotypes and randomly distributed in a square habitat Individuals are labelled by their genotype as 'g' followed by an integer label.
Individuals are chosen at random to found the next generation. They move seed dispersal to new location, with distances drawn from an exponential distribution. The population exists in a square habitat; any dispersal beyond the boundaries of the population is reflected back the same distance into the habitat.
A subset of the new generation are chosen to have been germinated from outcrossed seed. If so, they are given a new unique label by appending their current genotype label by the generation number plus a unique integer.
At each generation a transect through the population is drawn at x=0 with sampling points at equally spaced intervals. The plant closest to each sampling point is recorded.
Plants exist within a box centred around zero with a transect going through
zero. The width of the box is defined to be 1.5-fold larger than the length
of the transect (but this can be changed with the argument range_limit
).
Total population size is then the density of plants multiplied by the squared
width of the box.
Selection can be simulated by modelling fitness as log-normally distributed.
Genotypes are automatically assigned a log fitness values drawn from a normal
distribution with mean zero and variance var_w
. Following
Morrisey and Bonnet (2019; J. Heredity 110:396–402) absolute fitness is then
the exponent of these values, which is then divided by the mean to get
relative fitness. Seeds ar drawn in proportion to relative fitness.
A list of genotypes recorded at each sampling point in each generation.
Tom Ellis
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.