Description Usage Arguments Details Value References See Also Examples
View source: R/SIRTermTimeForcing.R
Solves a SIR model with corrected termtime forcing of the transmission rate.
1 2  SIRTermTimeForcing(pars = NULL, init = NULL, term.times = terms,
cicles = 10, low.term.first = TRUE)

pars 

init 

term.times 

cicles 
value indicating how many times 
low.term.first 
logical. If 
... 
further arguments passed to ode function. 
This is the R version of program 5.2 from page 171 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani.
This model is based on the behaviour os measles and other childhood diseases. Transmission rate is low during term == 1 (e.g. holydas term) and high during term == 1 (e.g. school term). We can define the year as the temporal unit of cicles
and each cicle is composed by a termtime
sequence (see example).
list
. The first element, *$model
, is the model function. The second, third and fourth elements are vectors (*$pars
, *$init
, *$time
, respectively) 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. Modeling Infectious Diseases in Humans and Animals
ode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  ## Parameters and initial conditions.
initials < c(S = 1/17, I = 1e4, R = 1  1/17  1e4)
parameters < list(beta0 = 17 / 13, beta1 = 0.25,
gamma = 1 / 13, mu = 1 / (50 * 365))
## Termtimes and cycles
# In a yearunit cicle, holidays happen for example
# between days 1 and 6, 101 and 115, 201 and 251,
# 301 and 307 and 308 and 365.
# Setting low.term.first == TRUE (default) we define the
# previous termtimes as low terms.
# Simulate 10 years.
terms < c(1, 6, 100, 115, 200, 251, 300, 307, 356, 365)
cicles < 10
# Solve and plot.
sir.term.time.forcing < SIRTermTimeForcing(pars = parameters,
init = initials,
term.times = terms,
cicles = 10)
PlotMods(sir.term.time.forcing)
# Solve bifurcation dynamics for 20 years.
# If the number of timeunits per cicle (e.g. days) times
# the number of cicles (e.g. number of days) is less
# than 3650, bifurcation dynamics are solved for 3650
# timesteps
parameters2 < list(beta0 = 17 / 13,
beta1 = seq(0, 0.3, by = 0.001),
gamma = 1 / 13, mu = 1 / (50 * 365))
# Uncomment the following lines (running it takes more than a few seconds):
# bifur < SIRTermTimeForcing(pars = parameters2, init = initials,
# term.times = terms, cicles = 10)
# PlotMods(bifur, bifur = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.