SIRBirthDeath {EpiDynamics} | R Documentation |
Solves a simple SIR model with equal births and deaths.
SIRBirthDeath(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 2.2 from page 27 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani.
All parameters must be positive and S + I + R <= 1.
list
. The first element, *$model
, is the model function. The second, third and fourth elements are the vectors *$pars
, *$init
, *$time
, containing the pars
, 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.
parameters <- c(mu = 1 / (70 * 365),
beta = 520 / 365, gamma = 1 / 7)
initials <- c(S = 0.1, I = 1e-4, R = 1 - 0.1 - 1e-4)
# Solve and plot.
sir.birth.death <- SIRBirthDeath(pars = parameters, init = initials,
time = 0:(60 * 365))
PlotMods(sir.birth.death)