The Azimuth Project
Experiments in discrete stochastic simulation using simplified predator-prey

Experiments in discrete stochastic simulation using simplified predator-prey

Idea

Working example during the development a C++ discrete time simulation framwork. The actual code is described in Discrete simulation code tutorial.

NOTE: these are messing-about experiments so the graphs below don’t have axis ticks labelled correctly.

Model

Incredibly simplified model where both rabbits and foxes live at most 2 years, and essentially reproduce when they turn 1 year old. They have fertility rates specified per individual, with no tracking of the division between males and females, and the number of babies produced by the population in total is taken as uniform variate rather than a more appropriate distribution. It also uses the oversimplified rule that if a fox needs to eat cc rabbits to survive for 1 year, then the foxes “telepathically” arrange so that an individual fox eats either exactly cc rabbits or no rabbits at all; more realistic modelling is a work-in-progress.

quantitysymbol
no of foxes born this yearf 0f_0
no of 1 year old foxesf 1f_1
half of maximum offspring from pair of foxesf ff_f
no of rabbits a fox needs to eat in a year to survivecc
no of rabbits born this yearr 0r_0
no of 1 year old rabbitsr 1r_1
half of maximum offspring from pair of rabbitsr fr_f
maximum carrying capacity of vegetation (in no of rabbits)K rK_r

System equations

The populations evolve from year to year with some stochastic equations (in discrete time):

(1)e =clampAbove(c(f 0 t+f 1 t),r 0 t+r 1 t) r 1 t+1 =vwhenv2wherev=r 0 tclampAbove(er 1 t,0) f 1 t+1 =vwhenv2wherev=clampAbove(e/c,f 0 t) r 0 t+1 =clampAbove(r 1 t+1r fU,K rr 1 t+1) f 0 t+1 =f 1 t+1f fU\begin{aligned} e &= clampAbove(c (f_0^t + f_1^t),r_0^t + r_1^t)\\ r_1^{t+1} &= v \quad when \quad v \geq 2 \quad where \quad v=r_0^t - clampAbove (e - r_1^t ,0)\\ f_1^{t+1} &= v \quad when \quad v \geq 2 \quad where \quad v=clampAbove (e/c,f_0^t)\\ r_0^{t+1} &= clampAbove(r_1^{t+1} r_f U, K_r - r_1^{t+1})\\ f_0^{t+1} &= f_1^{t+1} f_f U \end{aligned}

where UU denotes a fresh random variable uniformly distributed on [0,1)[0,1) for each occurrence.

Simulation results

Running the system for 2 222^22 different random simulation runs for various values of fox and rabbit fertility (for fixed cc, K rK_r, etc), the “fox population has not died out” probabilities after 50 years can be visualised in the below plot (where horizontal axis left to right is increasing fox fertility and vertical axis top to bottom is increasing rabbit fertility):

The “reasonably favourable values of fertility” for foxes lie in a range of about [2,2.6][2,2.6], and providing it’s above a minimum value rabbit fertility doesn’t matter.

The surival probabilities taken as a series of slices parallel to the “rabbit fertility axis”:

At least part of the reason why the curves go to a horizontal line is that, with a fixed “rabbit carrying capacity”, above a certain rabbit fertility level it’s carrying capacity rather than rabbit fertility that determines the number of rabbits.

The surival probabilities taken as a series of slices parallel to the “fox fertility axis”:

This looks like it might be a gamma distribution (speculation: this might possibly be because the “surviving trajectories” are ones that don’t hit any of the clamping terms, so somehow in the visualised region it’s a “nice” section which is the straightforward product of uniform random variates, which may have some nice closed-form?). Running a simulation with only 2 162^16 different random simulation runs has “kinks” which one couldn’t tell if are genuinely significant parts of the distribution or are “under-sampling” artifacts:

(The vertical axis tick labels are correct here: the absolute probability of surviving 50 years is indeed below 0.0060.006.)

It’s also interesting to see how the survival distribution evolves over time. Since there is an “absorbing barrier” at 0 (i.e., extinction) the survival probability can only decrease over time, so the distributions can be plotted on the same graph, with timesteps corresponding to consecutive curves moving downwards. Due to the drop off in scale making later curves difficult to see, these are plotted (with y-axis being probability, x-axis related to fox fertility) in blocks of 10 consecutive timesteps (again with a correct vertical axis labelling of probability):

Steps 0–9.

Steps 10–19.

Steps 20–29.

Steps 30–39.

As can be seen, the evolution towards the skewed beta-ish distribution after 50 steps starts with some distinctly different curve shapes.

For completeness, here are the other parameters used

Fixed system parametersValue
cc200
initial f 0f_0100
initial f 1f_10
initial r 0r_02cf 02 c f_0
initial r 1r_10
K rK_r5cf 05 c f_0

Notes

2 222^22 evaluations of 50 timesteps of this incredibly simple system for a 32×3232 \times 32 grid of system parameter values took about 3 hours on my PC.

category: experiments, software