Description Usage Arguments Details Value References See Also Examples
View source: R/SIRInducedMortality.R
Solves a SIR model with a probability of mortality, and unequal births and deaths.
1 |
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.3 from page 35 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani.
list
. The first element, *$model
, is the model function. The second, third and fourth elements are the vectors *$pars
, *$init
and *$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 number of susceptibles, infectious and recovered.
Keeling, Matt J., and Pejman Rohani. Modeling infectious diseases in humans and animals. Princeton University Press, 2008.
ode.
1 2 3 4 5 6 7 8 9 10 11 12 | # Parameters and initial conditions.
parameters <- c(rho = 0.5, mu = 1 / (70 * 365), nu = 1 / (70 * 365),
beta = 520 / 365.0, gamma = 1 / 7)
initials <- c(X = 0.2, Y = 1e-4, Z = 1 - 0.2 - 1e-4)
# Solve and plot.
# Uncomment the following lines (running it takes more than a few seconds):
# sir.induced.mortality <- SIRInducedMortality(pars = parameters,
# init = initials,
# time = 0:1e5)
# PlotMods(sir.induced.mortality)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.