make_step: Step System Forward in Time

Description Usage Arguments Value Author(s)

Description

Build a function that steps the system through one generation. Order of events is: (1) resolve fitness (2) introduce mutants.

make_step_equilibrium does a very simple minded attempt to converge on the equilibrium of a system by running it for a long time. It advances the system by dt (should be a largeish number) a number of times until the population size stabilises. This could be replaced by a multidimensional root finding approach.

Usage

1
2
3
4
5
6
7
8
9
make_step(fitness, mutation, dt, mu, y_initial)

make_step_continuous(fitness, mutation, dt, mu, y_initial, ...)

make_step_deterministic(fitness, ...)

make_step_equilibrium(fitness, ..., method)

make_step_mutation_limited(step_equilibrium, mutation, mu, y_initial)

Arguments

fitness

Function for computing fitness. Must take arguments x_new (phenotypes to compute fitness for), x (resident phenotypes) and y (resident abundances) and return the per-capita growth rate (g). The population will step forward with an Euler step, so that the new y will be y + y * g * dt.

mutation

Function for generating mutants. Must take arguments traits (resident phenotypes) and mutants (the number of mutants to generate, for each phenotype). See make_mutation, which generates a useful function.

dt

Size of the time step

mu

Mutation rate. On average there will be mu*dt*y mutations, with the actual number drawn from Poisson distribution.

y_initial

Abundance at which to introduce new mutants.

method

method to find equilibrium. Must be one of "runsteady" or "nleqslv" (or a contraction).

...

Additional arguments passed through to either rootSolve::runsteady or nleqslv::nleqslv.

step_equilibrium

Function generated by make_step_equilibrium.

Value

A Function that moves the system forward in time; it takes a list with elements x (traits), y (abundances) and t (time) and returns a list with these updated to the next steps.

Author(s)

Rich FitzJohn


traitecoevo/Revolve documentation built on May 31, 2019, 7:42 p.m.