Lotka Volterra

State

class whynot.simulators.lotka_volterra.State[source]

State of the Lotka-Volterra model.

foxes = 5.0

Number of foxes.

rabbits = 10.0

Number of rabbits.

Config

class whynot.simulators.lotka_volterra.Config[source]

Parameterization of Lotka-Volterra dynamics.

Examples

>>> # Configure the simulator so each caught rabbit creates 2 foxes
>>> lotka_volterra.Config(fox_growth=0.5)
delta_t = 1.0

Spacing of the evaluation grid

end_time = 100

End time of the simulator (in years).

fox_death = 1.5

Natural death rate of fox, when there’s no rabbits.

fox_growth = 0.75

Factor describing how many caught rabbits create a new fox.

rabbit_death = 0.1

Natural death rate of rabbits, due to predation.

rabbit_growth = 1.0

Natural growth rate of rabbits, when there’s no foxes.

start_time = 0

Start time of the simulator (in years).

Interventions

class whynot.simulators.lotka_volterra.Intervention(time=30, **kwargs)[source]

Parameterization of an intervention in the Lotka-Volterra model.

An intervention changes a subset of the configuration variables in the specified year. The remaining variables are unchanged.

Examples

>>> # Starting at time 25, set fox_growth to 0.4 (leave other variables unchanged)
>>> Intervention(time=25, fox_growth=0.4)
__init__(time=30, **kwargs)[source]

Specify an intervention in lotka_volterra.

Parameters:
  • time (int) – Time of intervention in simulator dynamics.
  • kwargs (dict) – Only valid keyword arguments are parameters of Config.

Experiments

Experiments on the Lotka-Volterra model.

whynot.simulators.lotka_volterra.experiments.RCT = lotka_volterra_rct

RCT experiment to determine effect of reducing number of caught rabbits that create a fox.

whynot.simulators.lotka_volterra.experiments.Confounding = lotka_volterra_confounding

Observational experiment with confounding due to initial fox population.

whynot.simulators.lotka_volterra.experiments.UnobservedConfounding = lotka_volterra_unobserved_confounding

Observational experiment with unobserved confounding due to initial fox population.