SIRSinusoidalBirth {EpiDynamics} | R Documentation |
Solves a SIR model with sinusoidal forcing of the birth rate.
SIRSinusoidalBirth(pars = NULL, init = NULL, time = NULL, ...)
pars |
|
init |
|
time |
time sequence for which output is wanted; the first value of times must be the initial time. |
... |
further arguments passed to ode function. |
This is the R version of program 5.3 from page 184 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani. To create bifurcations, alpha1
must be a vector. For bifurcations, if max(time) < 3650), time is defined as c(0:3650). Here, different to the original Python code, we wrote equations for the R population as R = 1 - S - I.
list
. The first element, *$model
, is the model function. The second element is a list
with the the *$pars
argument. The third and fourth elements are the vectors (*$init
, *$time
, containing the init
and time
arguments of the function. The fifth element *$results
is a data.frame
with up to as many rows as elements in time. First column contains the time. Second, third and fourth columns contain the proportion of susceptibles, infectious and recovered.
Keeling, Matt J., and Pejman Rohani. Modeling infectious diseases in humans and animals. Princeton University Press, 2008.
ode.
# Parameters and initial conditions (bifurcation plot of infectious)
parameters <- list(beta = 17 / 13, alpha0 = 1 / (50 * 365),
alpha1 = 0.25, w = 2 * pi / 365 ,
mu = 1 / (50 * 365), gamma = 1 / 13)
parameters2 <- list(beta = 17 / 13, alpha0 = 1 / (50 * 365),
alpha1 = seq(0, 0.99, 0.01), w = 2 * pi / 365 ,
mu = 1 / (50 * 365), gamma = 1 / 13)
initials <- c(S = 1 / 17, I = 1e-4, R = 1 - (1 / 17 + 1e-4))
# Solve and plot.
sir.sinusoidal.birth <- SIRSinusoidalBirth(pars = parameters,
init = initials,
time = 0:(20 * 365))
PlotMods(sir.sinusoidal.birth)
# Bifurcations
# Uncomment the following lines (running it takes more than a few seconds):
# bifurcation <- SIRSinusoidalBirth(pars = parameters2,
# init = initials,
# time = 0:(20 * 365))
# PlotMods(bifur, bifur = TRUE)