This version of the Lotka predator-prey model is given by
dY1/dt = c1*Y1 - c2*Y1*Y2
dY2/dt = c2*Y1*Y2 - c3*Y2
consisting of the three reaction channels,
Y1 --c1--> Y1 + Y1
Y1 + Y2 --c2--> Y2 + Y2
Y1 --c3--> 0
Load package
Define parameters
parms <- c(c1 = 10, c2 = .01, c3 = 10)
tf <- 2 # Final time
simName <- "Lotka predator-prey model" # Name
Define initial state vector
Define state-change matrix
Define propensity functions
Run simulations with the Direct method
set.seed(1)
out <- ssa(
x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.d(),
simName = simName,
verbose = FALSE,
consoleInterval = 1
)
ssa.plot(out, show.title = TRUE, show.legend = FALSE)
Run simulations with the Explict tau-leap method
set.seed(1)
out <- ssa(
x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.etl(tau = .002),
simName = simName,
verbose = FALSE,
consoleInterval = 1
)
ssa.plot(out, show.title = TRUE, show.legend = FALSE)
Run simulations with the Binomial tau-leap method
set.seed(1)
out <- ssa(
x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = ssa.btl(f = 100),
simName = simName,
verbose = FALSE,
consoleInterval = 1
)
ssa.plot(out, show.title = TRUE, show.legend = FALSE)
Run simulations with the Optimized tau-leap method