A fitnessEffect() callback is called by SLiM when it is determining the fitness of an individual – typically, but not always, once per tick during the fitness calculation tick cycle stage. Normally, the fitness of a given individual is determined by multiplying together the fitness effects of all mutations possessed by that individual (see section 25.2 for further discussion). Supplying a fitnessEffect() callback allows you to add another multiplicative fitness effect into that calculation. As with mutationEffect() callbacks, the value returned by fitnessEffect() callbacks is a fitness effect, so 1.0 is neutral. For details see SLiM Manual: page 715

fitnessEffect(subpop_id)

Arguments

subpop_id

The id(s) of the subpopulation(s) to which this callback should apply. Can be an integer 1, 2, etc., or character "p1", "p2", etc.

Value

None

Details

Global variables available in reproduction callbacks:

individual

The individual carrying this mutation (an object of class Individual)

subpop

The subpopulation in which that individual lives

Author

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)

Examples

slim_block(fitnessEffect(p3), {
  # multiplies all individual's fitness by 0.75
  return(0.75)
})
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1:1 fitnessEffect(p3) {
#>     return(0.75);
#> }