Learn R Programming

EpiDynamics (version 0.3.1)

SEIRnStages: SEIR model with n stages (P 3.5).

Description

Solves a SEIR model with multiple stages to create gamma-distributed exposed and infectious periods.

Usage

SEIRnStages(pars = NULL, init = NULL, time = NULL, ...)

Arguments

pars

vector with 5 values: the transmission rate, the removal or recovery rate, the death rate (we assume that nu=mu), the number of stages in the infected period and the number of stages in the exposed period. The names of these elements must be "beta", "gamma", "mu", "n" and "m", respectively, see example. All rates are specified in days and all rates and parameters must be positive, moreover, m < n.

init

vector with n + 1 values: initial proportions of the population that are susceptible and infected. The vector must be named, see example. Requirements: S + all Infected <= 1.

time

time sequence for which output is wanted; the first value of times must be the initial time.

...

further arguments passed to ode function.

Value

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. The following columns contain the proportion of susceptibles and infected.

Details

This is the R version of program 3.5 from page 94 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani.

References

Keeling, Matt J., and Pejman Rohani. Modeling infectious diseases in humans and animals. Princeton University Press, 2008.

See Also

ode.

Examples

Run this code
# NOT RUN {
# Parameters and initial conditions.
n <- 13
parameters <- list(beta = 17 / 5, gamma = 1 / 13, mu = 1 / (55 * 365),
                   n = n, m = 8)

initials <- c(S = 0.05, I = 0.00001 * rep(1, n) / n)

# Solve and plot.
# Uncomment the following lines (running it takes more than a few seconds):
# seir.n.stages <- SEIRnStages(pars = parameters, 
#                              init = initials, 
#                              time = seq(1, 30 * 365, 1))
# PlotMods(seir.n.stages, variables = 2)
# PlotMods(seir.n.stages, variables = 3:13, grid = F)
# }

Run the code above in your browser using DataLab