epidata function

Simulates epidemic for the specified model type and parameters

Simulates epidemic for the specified model type and parameters

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

epidata (type, n, tmin = NULL, tmax, sus.par, trans.par = NULL, beta = NULL, spark = NULL, Sformula = NULL, Tformula = 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.

  • sus.par: Susceptibility parameter (>0).

  • trans.par: Transmissibility parameter (>0).

  • beta: Spatial parameter(s) (>0) or network parameter (s) (>0) if contact network 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, ΩS(i)\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 susceptibility covariate information, Sformula is null.

  • Tformula: An object of class formula. See formula .

    Individual-level covariate information associated with transmissibility can be passed through this argument. An expression of the form ~ -1+model is interpreted as a specification that the transmissibility function, ΩT(j)\Omega_T(j) is modelled by a linear predictor specified symbolically by the model terms without the incorporation of the intercept term. Such a model consists of a series of terms separated by + and - operators. If there is no transmissibility covariate information, Tformula 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: A contact network matrix or an array of contact network matrices.

Details

We consider following two individual level models:

Spatial model:

P(i,t)=1exp{ΩS(i)jI(t)ΩT(j)dijβε} P(i,t) =1- \exp\{-\Omega_S(i) \sum_{j \in I(t)}{\Omega_T(j)d_{ij}^{-\beta}- \varepsilon}\}

Network model:

P(i,t)=1exp{ΩS(i)jI(t)ΩT(j)(β1Cij(1)++βnCij(n))ε} P(i,t) =1- \exp\{-\Omega_S(i) \sum_{j \in I(t)}{\Omega_T(j)(\beta_1 C^{(1)}_{ij}} + \dots + \beta_n C^{(n)}_{ij} )- \varepsilon\}

where P(i,t)P(i,t) is the probability that susceptible individual i is infected at time point t, becoming infectious at time t+1; ΩS(i)\Omega_S(i) is a susceptibility function which accommodates potential risk factors associated with susceptible individual i contracting the disease; ΩT(j)\Omega_T(j) is a transmissibility function which accommodates potential risk factors associated with infectious individual j; ε\varepsilon is a sparks term which represents infections originating from outside the population being observed or some other unobserved infection mechanism.

The susceptibility function can incorporate any individual-level covariates of interest and ΩS(i)\Omega_S(i) is treated as a linear function of the covariates, i.e., c("OmegaS(i)=alpha0+alpha1X1(i)+alpha2X2(i)+dots+\n\\Omega_S(i) = \\alpha_0 + \\alpha_1 X_1(i) + \\alpha_2 X_2 (i) + \\dots + \n", "alphansXns(i)\\alpha_{n_s} X_{n_s} (i)"), where X1(i),,Xns(i)X_1(i), \dots, X_{n_s} (i) denote nsn_scovariates associated with susceptible individual ii, along with susceptibility parameters α0,,αns>0\alpha_0,\dots,\alpha_{n_s} >0. If the model does not contain any susceptibility covariates then ΩS(i)=α0\Omega_S(i) = \alpha_0 is used. In a similar way, the transmissibility function can incorporate any individual-level covariates of interest associated with infectious individual. ΩT(j)\Omega_T(j) is also treated as a linear function of the covariates, but without the intercept term, i.e., ΩT(j)=ϕ1X1(j)+ϕ2X2(j)++ϕntXnt(j)\Omega_T(j) = \phi_1 X_1(j) + \phi_2 X_2 (j) + \dots + \phi_{n_t} X_{n_t} (j), where X1(j),,Xnt(j)X_1(j), \dots, X_{n_t} (j) denote the ntn_t covariates associated with infectious individual j, along with transmissibility parameters ϕ1,,ϕnt>0\phi_1,\dots,\phi_{n_t} >0. If the model does not contain any transmissibility covariates then ΩT(j)=1\Omega_T(j) = 1 is used.

Returns

An object of class epidata is returned containing the following:

  • type: Type of compartment framework, with the choice of "SI" for Susceptible-Infectious diseases and "SIR" for Susceptible-Infectious-Removed
  • XYcoordinates: The XY-coordinates of individuals.
  • contact: Contact network matrix.
  • inftime: The infection times of individuals.
  • remtime: The removal times of individuals when type = ``SIR''.

See Also

plot.epidata, epimcmc, epilike, pred.epi.

Examples

## Example 1: spatial SI model # generate 100 individuals x <- runif(100, 0, 10) y <- runif(100, 0, 10) covariate <- runif(100, 0, 2) out1 <- epidata(type = "SI",n = 100, Sformula = ~covariate, tmax = 15, sus.par = c(0.1, 0.3), beta = 5.0, x = x, y = y) # Plots of epidemic progression (optional) plot(out1, plottype = "spatial") plot(out1, plottype = "curve", curvetype = "newinfect") ## Example 2: spatial SIR model # generate infectious period(=3) for 100 individuals lambda <- rep(3, 100) out2 <- epidata(type = "SIR", n = 100, tmax = 15, sus.par = 0.3, beta = 5.0, infperiod = lambda, x = x, y = y) plot(out2, plottype = "spatial") plot(out2, plottype = "curve", curvetype = "newinfect") ## Example 3: SI network model contact1 <- matrix(rbinom(10000, 1, 0.1), nrow = 100, ncol = 100) contact2 <- matrix(rbinom(10000, 1, 0.1), nrow = 100, ncol = 100) diag(contact1[,] ) <- 0 diag(contact2[,] ) <- 0 contact <- array(c(contact1, contact2), dim = c(100, 100, 2)) out3 <- epidata(type = "SI", n = 100, tmax = 15, sus.par = 0.3, beta = c(3.0, 5.0), contact = contact) plot(out3, plottype = "curve", curvetype = "complete") plot(out3, plottype = "curve", curvetype = "susceptible") plot(out3, plottype = "curve", curvetype = "newinfect") plot(out3, plottype = "curve", curvetype = "totalinfect")

References

Deardon, R., Brooks, S. P., Grenfell, B. T., Keeling, M. J., Tildesley, M. J., Savill, N. J., Shaw, D. J., and Woolhouse, M. E. (2010). Inference for individual level models of infectious diseases in large populations. Statistica Sinica, 20, 239-261.

Deardon, R., Fang, X., and Kwong, G.P.S. (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.