Lotka-Volterra
Literature
The following is all taken from Graham’s PhD Thesis description (and Asymptotically Exact Inference), together with the following papers:
- Adapting the ABC Distance Function
- Automatic Posterior Transformation
- Fast epsilon-free inference
- Optimization Monte Carlo
Mathematical Set-Up
Suppose that
where
Coding
from math import sqrt
import numpy as np
from numpy.random import normal
def LV_simulator(theta):
# Settings
r = f = 100
dt = 1.0
sigma_f = sigma_r = 1.0
N = 50
t1, t2, t3, t4 = theta
# Store observations
y = []
# Generate white noise in advance
nr = normal(loc=0.0, scale=sigma_r, size=N)
nf = normal(loc=0.0, scale=sigma_f, size=N)
for i in range(N):
r = r + dt * (t1*r - t2*r*f) + sqrt(dt) * nr[i]
f = f + dt * (t4*r*f - t3*f) + sqrt(dt) * nf[i]
y.append(r)
y.append(f)
return np.array(y)
You can find more information at the following Google Colab notebook.
Summary Statistics
Sometimes (see Epsilon-free Inference and Graham’s PhD thesis) one can use the following sufficient statistics:
- The mean of the prey population
- The mean of the predator population
- The standard deviation of the prey population (or the log variance)
- The standard deviation of the predator population (or the log variance)
- The autocorrelation coefficient of lag 1 and 2 of the prey population
- The autocorrelation coefficient of lag 1 and 2 of the predator population
- The cross correlation coefficient between the prey and the predator population.