epidata {EpiILM} | R Documentation |

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)
```

`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 |

`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 |

`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. |

We consider following two individual level models:

**Spatial model:**

`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) =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)`

is the probability that susceptible individual i is infected at time point t, becoming infectious at time t+1;
`\Omega_S(i)`

is a susceptibility function which accommodates potential risk factors associated with susceptible individual i contracting the disease; `\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 `\Omega_S(i)`

is treated as a linear function of the covariates, i.e., ```
\Omega_S(i) = \alpha_0 + \alpha_1 X_1(i) + \alpha_2 X_2 (i) + \dots +
\alpha_{n_s} X_{n_s} (i)
```

, where `X_1(i), \dots, X_{n_s} (i)`

denote `n_s`

covariates associated with susceptible individual $i$, along with susceptibility parameters `\alpha_0,\dots,\alpha_{n_s} >0`

. If the model does not contain any susceptibility covariates then `\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. `\Omega_T(j)`

is also treated as a linear function of the covariates, but without the intercept term, i.e., `\Omega_T(j) = \phi_1 X_1(j) + \phi_2 X_2 (j) + \dots + \phi_{n_t} X_{n_t} (j)`

, where `X_1(j), \dots, X_{n_t} (j)`

denote the `n_t`

covariates associated with infectious individual j, along with transmissibility parameters `\phi_1,\dots,\phi_{n_t} >0`

. If the model does not contain any transmissibility covariates then `\Omega_T(j) = 1`

is used.

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”.

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.

`plot.epidata`

, `epimcmc`

, `epilike`

, `pred.epi`

.

```
## 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")
```

[Package *EpiILM* version 1.5.2 Index]