Learn R Programming

EpiILM (version 1.2)

epidata:

Description

This function allows the user to simulate epidemics under different models and scenarios

Usage

epidata(type, n, tmin = NULL, tmax, alpha, beta, spark = NULL, Sformula = NULL, x = NULL, 

y = NULL, inftime = NULL, infperiod = NULL, contact = NULL)

Arguments

type
Type of compartment framework, with the choice of "SI" for Susceptible-Infectious diseases and "SIR" for Susceptible-Infectious-Removed
n
Population size
tmin
The time point at which simulation begins, default value is one
tmax
The last time point of simulation
alpha
Susceptibility parameter (>0)
beta
Spatial parameter(s) (>0) or network parameter (s) (>0) if contact is used
spark
Sparks parameter (>=0), representing infections unexplained by other parts of the model (eg. infections coming in from outside the observed population), default value is zero
Sformula
An object of class formula. See formula

Individual-level covariate information associated with susceptibility can be passed through this argument. An expression of the form ~ model is interpreted as a specification that the susceptibility function, \(\Omega_s(i) \) is modelled by a linear predictor specified symbolically by the model term. Such a model consists of a series of terms separated by + and - operators. If there is no covariate information, Sformula is null

x
X coordinates of individuals
y
Y coordinates of individuals
inftime
Times at which individuals are infected to initialize epidemic simulation
infperiod
Length of infectious period for each individual
contact
Contact network matrix (matrices)

Value

inftime
Times at which individuals become infected/infectious
removaltime
Times at which individuals are removed

Details

We consider following two individual level models: Spatial model: $$P(i,t) =1- \exp\{-\Omega_s(i) \sum_{j \in I(t)}{d_{ij}^{-\beta}- \varepsilon}\}$$ Network model: $$P(i,t) =1- \exp\{-\Omega_s(i) \sum_{j \in I(t)}{(\beta_1 C^{(1)}_{ij}} + \dots + \beta_n C^{(n)}_{ij} )- \varepsilon\}$$ where \(P(i,t)\) is the probability that susceptible individual i is infected at time point t, becoming infectious at time t+1; and \(\Omega_s(i) \) is a susceptibility function which accommodates potential risk factors associated with susceptible individual i contracting the disease.

References

Deardon R, Brooks, S. P., Grenfell, B. T., Keeling, M. J., Tildesley, M. J., Savill, N. J., Shaw, D. J., Woolhouse, M. E. (2010). Inference for individual level models of infectious diseases in large populations. Statistica Sinica, 20, 239-261. Rob Deardon, Xuan Fang, and Grace Pui Suze Kwong (2014). Statistical modelling of spatio-temporal infectious disease transmission in analyzing and modeling Spatial and temporal dynamics of infectious diseases, (Ed: D. Chen, B. Moulin, J. Wu), John Wiley & Sons. Chapter 11.

Examples

Run this code


## Example 1:  spatial SI model 
# generate 100 individuals

x <- runif(100,0,10)
y <- runif(100,0,10)
covariate <- runif(100,0,2)

out <- epidata(type="SI",n=100, Sformula=~covariate, tmax=15, alpha=c(0.1,0.3), beta=5.0, x=x, y=y)

# Plots of epidemic progression (optional)

epispatial(type="SI", x=x, y=y, inftime=out$inftime)
epicurve(type="SI", inftime=out$inftime, plottype="newinfect")

## Example 2: spatial SIR model 
# generate infectious period(=3) for 100 individuals 

lambda <- rep(3,100)
epidata(type="SIR",n=100, tmax=15, alpha=0.3,beta=5.0, infperiod=lambda, x=x, y=y)

## Example 3:   SI network model 
## Not run: ------------------------------------
# contact1 <- matrix(rbinom(1000,1,0.1), nrow=100, ncol=100)
# contact2 <- matrix(rbinom(1000,1,0.1), nrow=100, ncol=100)
# diag(contact1[,] ) <- 0
# diag(contact2[,] ) <- 0
# contact <- array(c(contact1,contact2),dim=c(100,100,2))
# epidata(type="SI", n=100, tmax=15, alpha=0.3,beta=c(3.0,5.0), contact=contact)
# 
## ---------------------------------------------

Run the code above in your browser using DataLab