warnRelativesGraph: Warning Relatives When Under Attack (Graph Version)

Description Usage Arguments Value Examples

View source: R/attack.R

Description

Default function to govern behavior of warners under attack. Warner warns a specified number of the most closely-related individuals. May be used as an alternative function in which the values of warnable_relationship and dominant are specified.

Usage

1
2
3
warnRelativesGraph(individuals, number_warned, warner_death_prob,
  nonwarner_death_prob, hider_death_prob, order = 2, relGraph,
  dominant = FALSE)

Arguments

individuals

Data frame containing id, sex, warner-status, mother id and father id. Value provided.

number_warned

Maximum number of individuals to warn. Value provided.

warner_death_prob

As in simulate. Value provided.

nonwarner_death_prob

As in simulate. Value provided.

hider_death_prob

As in simulate. Value provided.

order

Maximum distance a relative can have and still be warned.

relGraph

The current relationship graph. Value provided.

dominant

If TRUE, individuals with 1 or more altruistic alleles can warn. Default version sets this to FALSE.

Value

A numerical vector of death probabilities in which the i^{\text{th}} element corresponds to row i of individuals.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
pop <- simulate(sim_gens = 200,
                relationship_method = "graph",
                attack_behavior = list(
                  fn = warnRelativesGraph,
                  args = list(
                    number_warned = 10,
                    dominant = TRUE)))

## End(Not run)

homerhanumat/simaltruist documentation built on May 25, 2019, 5:26 p.m.