Description Usage Arguments Value Note Examples
Simulate Spread of Gene for Altruism
1 2 3 4 5 6 7 | simulate(initial_pop = list(m0 = 90, m1 = 0, m2 = 10, f0 = 90, f1 = 0, f2 =
10), average_litter_size = 5, birth_rate_natural = 0.05,
death_rate_natural = 0, prob_attack = 0.2, warner_death_prob = 0.4,
nonwarner_death_prob = 0.2, hider_death_prob = 0, sim_gens = 2,
capacity = 2000, mating_behavior = NULL, culling_behavior = NULL,
attack_behavior = NULL, relationship_method = c("matrix", "graph",
"none"), graph = TRUE)
|
initial_pop |
List comprised of six named elements:
|
average_litter_size |
Mean size of a litter. |
birth_rate_natural |
Birth rate for the population. |
death_rate_natural |
Death rate for a size-zero population. Rises
linearly to |
prob_attack |
The probability of a predator attack in any given generation. |
warner_death_prob |
Probability that an individual who warns others during an attack will be killed. |
nonwarner_death_prob |
Probability of death for an individual who does not warn others but who was not forewarned by a warner. |
hider_death_prob |
Probability of death during an attack for an individual who accepts a warning. |
sim_gens |
Number of generations to simulate. |
capacity |
Carrying capacity of the population. |
mating_behavior |
Custom function to govern how eligible partners form couples. |
culling_behavior |
Custom function to determine death probabilities of individuals at the culling stage.. |
attack_behavior |
Custom function to govern behavior of warners when population is under attack. |
relationship_method |
One of |
graph |
If |
A data frame with information on the population at each generation. Each row describes the population at the end of a single birth-death-attack cycle. Variables are:
total population
total number of males
number of males with no alleles for altruism
number of males with one allele for altruism
number of males with two alleles for altruism
total number of females
number of females with no alleles for altruism
number of females with one allele for altruism
number of females with two alleles for altruism
For details on mating_behavior
, mating_behavior
and attack_behavior
consult the
package documentation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
# use defaults, get a graph:
pop <- simulate(sim_gens = 400)
# attacks are infrequent, and it's dangerous to warn:
pop <- simulate(sim_gens = 200,
warner_death_prob = 0.8,
attack_prob = 0.05)
# use an alternative mating function exported by package:
pop <- simulate(sim_gens = 200,
warner_death_prob = 0.8,
mating_behavior = list(
fn = sexualSelection,
args = list(
matrix(
c(1, 5, 10, 1, 1, 1, 10, 5, 1),
nrow = 3,
ncol = 3))))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.