Learn R Programming

EpiDynamics (version 0.3.1)

SIRTauLeap: SIR model with tau leap method (P 6.5).

Description

SIR model with demographic stochasticity approximated using the tau-leap method and assuming Poisson distributions.

Usage

SIRTauLeap(pars, init, end.time)

Arguments

pars

vector with 5 values: the transmission, recovery and death rates, the population size assumed to be constant and the time step. The names of these values must be "beta", "gamma", "mu", "N" and "tau" respectively.

init

vector with 3 values: the initial number of susceptibles, infectious and recovered, respectively. The names of these values must be "X", "Y" and "Z" respectively.

end.time

end time to be simulated.

Value

list. The first three elements are the vectors *$pars, *$init and *$time, containing the pars, init and end.time arguments of the function. The fourth element *$results is a data.frame with up to as many rows as time steps determined by the parameters tau and end.time. The first column contains the time steps. The second, third and fourth columns contain the number of susceptibles, infectious and recovered.

Details

This is the R version of program 6.5 from page 204 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.

Examples

Run this code
# NOT RUN {
# Parameters and initial conditions.
parameters <- c(beta = 1, gamma = 1 / 10, mu = 5e-4, N = 50, tau = 1)
initials <- c(X = 5, Y = 1, Z = 44)
end.time <- 2 * 365

# Solve and plot.
sir.demog.stoch <- SIRTauLeap(pars = parameters, init = initials,
                              end.time = end.time)
PlotMods(sir.demog.stoch)

# }

Run the code above in your browser using DataLab