Description Usage Arguments Details Value References See Also Examples
View source: R/SIRSinusoidalForcing.R
Solves a SIR model with sinusoidal forcing of the transmission rate.
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 5.1 from page 160 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani.
When beta1 is a vector in pars
, it must be a sequence between 0 and 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Parameters and initial conditions.
parameters <- list(beta0 = 17 / 13, beta1 = 0.1, gamma = 1 / 13,
omega = 2 * pi / 365, mu = 1 / (50 * 365))
initials <- c(S = 1 / 17, I = 1e-4,
R = 1 - 1 / 17 - 1e-4)
# Solve and plot.
sir.sinusoidal.forcing <- SIRSinusoidalForcing(pars = parameters,
init = initials,
time = 0:(60 * 365))
PlotMods(sir.sinusoidal.forcing)
# Solve bifurcation dynamics for 20 years.
# If max(time) < 3650, bifurcation dynamics are solved for 3650 time-steps.
parameters2 <- list(beta0 = 17 / 13, beta1 = seq(0.001, 0.251, by = 0.001),
gamma = 1 / 13, omega = 2 * pi / 365, mu = 1 / (50 * 365))
# Uncomment the following lines (running it takes more than a few seconds):
# bifur <- SIRSinusoidalForcing(pars = parameters2,
# init = initials,
# time = 0:(20 * 365))
# PlotMods(bifur, bifur = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.