Learn R Programming

EpiModel (version 0.95)

epiICM: Individual Contact Epidemic Models

Description

This function simulates individual contact transmission models for infectious disease.

Usage

epiICM(type, groups = 1, s.num, i.num, r.num = 0, trans.rate, act.rate,
  rec.rate = 0, b.rate = 0, ds.rate = 0, di.rate = 0, dr.rate = 0,
  s.num.g2, i.num.g2, r.num.g2 = 0, trans.rate.g2, act.rate.g2,
  rec.rate.g2 = 0, b.rate.g2 = 0, ds.rate.g2 = 0, di.rate.g2 = 0,
  dr.rate.g2 = 0, balance, nsteps, rec.rand = TRUE, b.rand = TRUE,
  d.rand = TRUE, nsims = 1, verbose = TRUE)

Arguments

type
disease type to be modeled, with the choice of "SI" for Susceptible-Infected diseases, "SIR" for Susceptible-Infected-Recovered diseases, and "SIS" for Susceptible-Infected-Susceptible diseases.
groups
number of mixing groups to model, with the default of 1 for purely random mixing in the population, or 2 for purely heterogenous mixing (e.g., two sexes with purely heterosexual contact).
s.num
number of initial susceptibles in the population. For two-group models, this is the number of initial group 1 susceptible in the population.
i.num
number of initial infecteds in the population. For two-group models, this is the number of initial group 1 infected in the population.
r.num
number of initial recovereds in the population. For two-group models, this is the number of initial group 1 recovered in the populations. This parameter is only used for the SIR model type.
trans.rate
probability of transmission given an act or contact between a susceptible and an infected person in the population. In two-group models this is the rate governing the probability of transmission to the group 1 members.
act.rate
average number of acts governing transmission per person per unit time, regardless of disease status. For two-group models, this is the number of acts per group 1 persons per unit time; note that a balance between the acts in groups 1 and 2 is nec
rec.rate
average rate of recovery with immunity (in SIR models) or re-susceptibility (in SIS models). The recovery rate is a function of the disease duration as 1/duration of disease. For two-group models, this is the recovery rat
b.rate
birth rate into the population. For one-group models, the birth rate is the probability of a new birth per person per unit time. For two-group models, the birth rate may be parameterized as a rate per group 1 person per unit time (with group 1 per
ds.rate
mortality rate for susceptibles, i.e. the probability of death per susceptible person per unit time. For two-group models, it is the rate for the group 1 susceptibles only.
di.rate
mortality rate for infecteds, i.e., the probability of death per infected person per unit time. For two-group models, it is the rate for the group 1 infecteds only.
dr.rate
mortality rate for recovereds, i.e., the probability of death per recovered person per unit time. For two-group models, it is the rate for the group 1 recovered only. This parameter is only used for SIR models.
s.num.g2
number of initial susceptibles in group 2 in the population. This parameter is only used for two-group models.
i.num.g2
number of initial infecteds in group 2 in the population. This parameter is only used for two-group models.
r.num.g2
number of initial recovereds in group 2 in the population. This parameter is only used for two-group SIR models.
trans.rate.g2
probability of transmission given an act or contact between a susceptible group 2 person and an infected group 1 person in the population. It is the rate governing the probability of transmission to group 2 members.
act.rate.g2
average number of acts capable of transmission per group 2 person per unit time. Note that a balance between the acts in groups 1 and 2 is necessary, and set using the balance parameter.
rec.rate.g2
average rate of recovery with immunity (in SIR models) or re-susceptibility (in SIS models) for group 2 persons. This parameter is only used for two-group SIR and SIS models.
b.rate.g2
birth rate into the population for group 2. This may either be specified numerically as the number of new births per group 2 persons per unit time, or as NA in which case the group 1 rate, b.rate, governs the birth proces
ds.rate.g2
mortality rate for group 2 susceptibles, i.e., the probability of death per group 2 susceptible person per unit time.
di.rate.g2
mortality rate for group 2 infecteds, i.e., the probability of death per group 2 infected person per unit time.
dr.rate.g2
mortality rate for group 2 recovereds, i.e., the probability of death per group 2 recovered person per unit time. This parameter is only used for SIR model types.
balance
for two-group models, balance the act.rate to the rate set for group 1 (with balance="g1") or group 2 (with balance="g2"). Further details provided below.
nsteps
number of time steps to solve the model over. This must be a positive integer.
rec.rand
if TRUE, use a stochastic recovery model, with the number of recovered a random draw from a Poisson distribution for the product of the recovery rate and the number infected. If FALSE, then a deterministic rounded count o
b.rand
if TRUE, use a stochastic birth model, with the number of new births a random draw from a Poisson distribution for the product of the birth rate and population size. If FALSE, then a deterministic rounded count of that pr
d.rand
if TRUE, use a stochastic mortality model, with the number of new deaths a random draw from a Poisson distribution for the product of the state-specific death rates and the state size. If FALSE, then a deterministic round
nsims
number of simulations to run.
verbose
print model simulation progress to the console.

Value

  • This function returns a list object of class epiICM with the following elements:
    • type:disease type as specified in model parameter.
    • groups:groups as specified in model parameter.
    • params:list of model parameters as specified in model parameter.
    • time:a vector of time steps over which the model was solved.
    • vital:logical, whether vital dynamics were specified in the parameterization.
    • nsims:number of model simulations.
    • call:exact model call.
    • *.num:a vector (ifnruns=1) or data frame (ifnruns>1) of compartment or state sizes over time, for each model run, where * may equals,i, orrfor susceptible, infected, or recovered, respectively. Two group models have equivalent elements with a.g2suffix.
    • *.flow:a vector (ifnruns=1) or data frame (ifnruns>1) of transition sizes between compartments, for each model run, where * may equalsifor susceptible to infected flows,isfor infected to susceptible flows,irfor infected to recovered flows,bfor birth in-flows,dsfor susceptible death out-flows,difor infected death out-flows,drfor recovered death out-flows. Two group models have equivalent elements with a.g2suffix.

The act.rate Parameter

The act.rate parameter represents the average number of acts capable of transmission per person per unit time. In the sexually transmitted disease modeling literature, the term ``contact'' if often used, as in the standard formulation $R_0=\beta c D$. But contact may either mean the number of independent acts or number of partnerships per person per unit time. In the latter case, one often obtains the risk of transmission within a partnership per unit time by solving the formula $\tau = 1-(1-\alpha)^n$, where $\tau$ is the probability of transmission per partnership, $\alpha$ is the probability of transmission per act, and $n$ is the number of acts per partnership. act.rate parameter is to be distinguished from ``effective contact,'' which here is the product of trans.rate and act.rate.

In two-group models, it is necessary to maintain a balance between the number of acts for group 1 members and those for group 2 members. Mathematically in a purely heterogenous mixing framework, the product of one group size and act rate must equal the product of the other group size and act rate: $N_1 \alpha_1 = N_2 \alpha_2$, where $N_i$ is the group size and $\alpha_i$ the group-specific act rates at time $t$.

Details

The epiICM function is a stochastic, discrete-time representation of the deterministic compartmental disease models that may be solved with epiDCM. Random variation is simulated in all transition processes: infection, recovery, and vital dynamics. The stochasticity in each transition except infection may be toggled on or off using the control parameters rec.rand, b.rand, and d.rand.

One important caveat is the current parameter structure of specifing initial state sizes and individual parameters as primary epiICM parameters will be deprecated in the EpiModel v1.0 release. More flexibile passing of model behavior and parameters will be implemented.

See Also

plot.epiICM, summary.epiICM, as.data.frame.epiICM

Examples

Run this code
# SI Model
mod <- epiICM(type="SI", s.num=500, i.num=1,
              trans.rate=0.2, act.rate=0.25, nsteps=500, nsims=10)
plot(mod)

# SIR Model
mod <- epiICM(type="SIR", s.num=500, i.num=1,
              trans.rate=0.2, act.rate=0.25, rec.rate=1/50,
              nsteps=500, nsims=10)
plot(mod, y="r.num", sim.lines=TRUE, sim.alpha=0.25)

# SIS Model
mod <- epiICM(type="SIS", s.num=500, i.num=1,
              trans.rate=0.2, act.rate=0.25, rec.rate=1/50,
              nsteps=500, nsims=10)
plot(mod, sim.lines=T, qnts=FALSE, sim.col=c("steelblue", "red"),
     leg.cex=0.75, popfrac=FALSE)

Run the code above in your browser using DataLab