SIR: Simple SIR model (P 2.1).

Description Usage Arguments Details Value References See Also Examples

View source: R/SIR.R

Description

Solves a simple SIR model without births or deaths.

Usage

1
SIR(pars = NULL, init = NULL, time = NULL, ...)

Arguments

pars

vector with 2 values: the transmission and recovery rates. The names of these values must be "beta", and "gamma", respectively.

init

vector with 3 values: the initial proportion of susceptibles, infectious and recovered. The names of these values must be "S", "I" and "R", respectively.

time

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

...

further arguments passed to ode function.

Details

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

All parameters must be positive and S + I + R <= 1.

Value

list. The first element, *$model, is the model function. The second, third and fourth elements are the vectors *$pars, *$init and *$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.

References

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

See Also

ode.

Examples

1
2
3
4
5
6
7
# Parameters and initial conditions.
parameters <- c(beta = 1.4247, gamma = 0.14286)
initials <- c(S = 1 - 1e-06, I = 1e-06, R = 1 - (1 - 1e-06 - 1e-06))

# Solve and plot.
sir <- SIR(pars = parameters, init = initials, time = 0:70)
PlotMods(sir)

EpiDynamics documentation built on March 26, 2020, 6:33 p.m.