Description Usage Arguments Details Value References See Also Examples
View source: R/SEIR4AgeClasses.R
Solves a SEIR model with four different agegroups and yearly "movements" between the groups mimicking the school year
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 3.4 from page 87 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani.
All rates are specified in days. Moreover, a vector
n with the proportion of each age group. All parameters must be positive.
list
of class SolveSIR4ACYA
. 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. The following columns contain the proportion of susceptibles, exposed, 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  # Parameters and initial conditions.
parameters < list(beta = matrix(c(2.089, 2.089, 2.086, 2.037,
2.089, 9.336, 2.086, 2.037,
2.086, 2.086, 2.086, 2.037,
2.037, 2.037, 2.037, 2.037),
nrow = 4, ncol = 4),
sigma = 0.125, gamma = 0.2,
mu = c(0, 0, 0, 1) / (55 * 365),
nu = c(1 / (55 * 365), 0, 0, 0),
n = c(6, 4, 10, 55) / 75)
initials < c(S = c(0.05, 0.01, 0.01, 0.008),
E = c(0.0001, 0.0001, 0.0001, 0.0001),
I = c(0.0001, 0.0001, 0.0001, 0.0001),
R = c(0.0298, 0.04313333, 0.12313333, 0.72513333))
# Solve and plot.
# Uncomment the following lines (running it takes more than a few seconds):
# seir4.age.classes < SEIR4AgeClasses(pars = parameters,
# init = initials,
# time = 0:36500)
# PlotMods(seir4.age.classes,
# variables = c('I1', 'I2', 'I3', 'I4'), grid = F)

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