Learn R Programming

EpiDynamics (version 0.3.1)

SIRSinusoidalBirth: SIR model with sinusoidal births (P 5.3).

Description

Solves a SIR model with sinusoidal forcing of the birth rate.

Usage

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

Arguments

pars

list with: the transmission rate, the mean birth rate, a scalar (or a vector to create bifurcations) with the amplitude of sinuoidal forcing for the birth rate, the frequency of the oscillations, the per capita death rate and the recovery rate. The names of these values must be "beta", "alpha0", "alpha1", "w", "mu" and "gamma", respectively. All rates must be specified in days and alpha1 <= 1.

init

vector with 3 values: the initial proportion of susceptibles and infectious. The names of these values must be "S" and "I", respectively. All parameters must be positive and S + I <= 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 element is a list with the the *$pars argument. The third and fourth elements are the vectors (*$init, *$time, containing the 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.

Details

This is the R version of program 5.3 from page 184 of "Modeling Infectious Disease in humans and animals" by Keeling & Rohani. To create bifurcations, alpha1 must be a vector. For bifurcations, if max(time) < 3650), time is defined as c(0:3650). Here, different to the original Python code, we wrote equations for the R population as R = 1 - S - I.

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 (bifurcation plot of infectious)
parameters <- list(beta = 17 / 13, alpha0 = 1 / (50 * 365),
                   alpha1 = 0.25, w = 2 * pi / 365 ,
                   mu = 1 / (50 * 365), gamma =  1 / 13)

parameters2 <- list(beta = 17 / 13, alpha0 = 1 / (50 * 365),
                   alpha1 = seq(0, 0.99, 0.01), w = 2 * pi / 365 ,
                   mu = 1 / (50 * 365), gamma =  1 / 13)

initials <- c(S = 1 / 17, I = 1e-4, R =  1 - (1 / 17 + 1e-4))

# Solve and plot.
sir.sinusoidal.birth <- SIRSinusoidalBirth(pars = parameters,
                                           init = initials, 
                                           time = 0:(20 * 365))
PlotMods(sir.sinusoidal.birth)

# Bifurcations
# Uncomment the following lines (running it takes more than a few seconds):
# bifurcation <- SIRSinusoidalBirth(pars = parameters2,
#                                   init = initials, 
#                                   time = 0:(20 * 365))
# PlotMods(bifur, bifur = TRUE)
# }

Run the code above in your browser using DataLab