Description Usage Arguments Details Value References See Also Examples
View source: R/SIRPartialImmunity.R
Solves a model with partial immunitiy.
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 4.1 from page 118 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
, *$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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Parameters and initial conditions.
parameters <- c(mu = 1 / (70 * 365), beta1 = 260 / 365,
beta2 = 520 / 365, gamma1 = 1 / 7,
gamma2 = 1 / 7, alpha1 = 0.5,
alpha2 = 0.4, a1 = 0.4, a2 = 0.5)
initials <- c(NSS = 0.1, NIS = 1e-4, NRS = 0.02, NRI = 0,
NSI = 1e-4, NSR = 0.5, NIR = 0, NRR = 0.3798)
# Solve and plot.
sir.partial.immunity <- SIRPartialImmunity(pars = parameters,
init = initials,
time = 0:(100 * 365))
PlotMods(sir.partial.immunity, variables = c('NIS', 'NIR'), grid = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.