Learn R Programming

EpiDynamics (version 0.3.1)

SISnRiskGroups: SIS model with multiple risk groups (P 3.2).

Description

Solves a SIS model with n different risk-groups.

Usage

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

Arguments

pars

list with: the number of risk groups, a (m x m) matrix with the transmission rates, a vector with the recovery rates (one for each risk group) and a vector with the proportions of the population that are in each risk group. The names of these elements must be "m", "beta", "gamma" and "n", respectively (see example). All rates are specified in years.

init

vector with m * 2 values: the initial proportions of susceptibles and infectious in each risk group. The names of these values must be "S1",..., "Sm" and "I1",..., "Im", respectively (see example). All initial states must be positive and Si + Ii = ni, i= 1, ..., m.

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 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. The following columns contain the proportion of susceptibles and infectious of each risk group.

Details

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

All parameters must be positive, and ni <= 1, sum(ni) = 1, i = 1, ..., m.

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.
tmp <-matrix(c(0, 3, 10, 60, 100))
beta <- 0.0016 * tmp %*% t(tmp)
parameters <- list(m = 5, beta = beta, 
                   gamma = c(0.2, 0.2, 0.2, 0.2, 0.2),
                   n = c(0.06, 0.31, 0.52, 0.08, 0.03))
initials <- c(I = c(0, 0, 0, 0, 1e-5))

# Solve and plot.
sis.n.riks.groups <- SISnRiskGroups(pars = parameters, 
                                    init = initials, 
                                    time = 0:30)
PlotMods(sis.n.riks.groups, grid = FALSE)

# }

Run the code above in your browser using DataLab