The logistic growth model is given by dN/dt = rN(1-N/K) where N is the number (density) of indviduals at time t, K is the carrying capacity of the population, r is the intrinsic growth rate of the population. We assume r=b-d where b is the per capita p.c. birth rate and d is the p.c. death rate.
This model consists of two reaction channels,
N ---b---> N + N
N ---d'---> 0
where d'=d+(b-d)N/K. The propensity functions are a_1=bN and a_2=d'N.
Load package
Define parameters
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 = "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 = "ETL",
tau = .03,
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 = "BTL",
f = 5,
simName = simName,
verbose = FALSE,
consoleInterval = 1
)
ssa.plot(out, show.title = TRUE, show.legend = FALSE)Run simulations with the Optimized tau-leap method
set.seed(1)
out <- ssa(
x0 = x0,
a = a,
nu = nu,
parms = parms,
tf = tf,
method = "OTL",
simName = simName,
verbose = FALSE,
consoleInterval = 1
)
ssa.plot(out, show.title = TRUE, show.legend = FALSE)