datagen {EpiILMCT} | R Documentation |
Generate epidemics from distance-based and/or network-based continuous-time ILMs.
Description
Generate epidemics from distance-based and/or network-based ILMs.
Usage
datagen(type, kerneltype, kernelmatrix, distancekernel = NULL,
initialepi = NULL, tmax = NULL, suspar = NULL, transpar = NULL,
powersus = NULL, powertrans = NULL, kernel.par = NULL, spark = NULL,
gamma = NULL, delta, suscov = NULL, transcov = NULL)
Arguments
type |
type of compartmental framework, with the choice of “SIR” for Susceptible-Infectious-Removed and “SINR” for Susceptible-Infectious-Notified-Removed. |
kerneltype |
type of kernel function with choice of “distance” for a distance-based ILM, “network” for a contact network-based ILM and “both” for a combination of network- and distance-based ILM. |
kernelmatrix |
a matrix of the XY coordinates of individuals when |
distancekernel |
the spatial kernel type when |
initialepi |
a matrix of the initial |
tmax |
the time at which the epidemic simulation ends. If not set the simulation is run until the epidemic dies out or all individuals are infected and then enter the removed state. |
suspar |
parameter(s) for the susceptibility function (>0). Default value(s) is 1. |
transpar |
parameter(s) for the transmissibility function (>0). Default value(s) is 1. |
powersus |
the power parameter(s) of the susceptibility function (>0). Default value(s) is 1. |
powertrans |
the power parameter(s) of the transmissibility function (>0). Default value(s) is 1. |
kernel.par |
a scalar spatial parameter when |
spark |
spark parameter (>=0), representing random infections that are unexplained by other parts of the model. Default value is 0. |
gamma |
the notification effect parameter for SINR model. The default value is 1. |
delta |
a vector of the shape and rate parameters of the gamma-distributed infectious period (SIR) or a |
suscov |
covariate matrix of the susceptibility function, representing each covariate in a column. If intercept exists or in the case of no covariates, the first column is set to unity. |
transcov |
covariate matrix of the transmissibility function, representing each covariate in a column. If intercept exists or in the case of no covariates, the first column is set to unity. |
Details
We consider the simulation of epidemics from continuous-time ILMs in the following way. Each infected individual has an infection life history defined by their time of infection and the length of time spent in the infectious state. We are assuming the conditional intensity functions stay constant between events, so that the time to the next infected individual, given that the last infection occurred at time t
, is given by the minimum W_{j} \sim Exp(\lambda_{jt})
, where W_{j}
represents the “waiting time” for susceptible individual j
becoming infected.
Under both SIR and SINR ILMs option, an epidemic is simulated using the specified model starting with a randomly chosen infected individual k
at time I_{1}
, or as specified via the initialepi
option. Under the SIR model, the rate of infection of each susceptible individual j
at time t
\in \rm I\!R^{+}
follows the framework of Deardon et al. (2010):
where \mathcal{I}(t)
is the set of infectious individual at time t
. Under the SINR model, the rate of infection of each susceptible individual j
at time t
follows Jewell et al. (2009):
where \mathcal{N}^{-}{(t)}
is the set of infectious individual at time t
who have been infected but have not reached the notified state; \mathcal{N}^{+}{(t)}
is the set of infectious individual at time t
who have been infected and reached the notified state; \gamma
is the notification effect parameter usually allowing for infectious risk reduction after notification (Jewell et al., 2009); \Omega_{S}(j)
is a function of risk factors associated with susceptible individual j
(i.e., susceptibility); and \Omega_{T}(i)
is a function of risk factors associated with infectious individual i
(i.e., transmissibility). The \Omega_{S}(j)
and \Omega_{T}(i)
are defined as:
where \mathbf{S}
and \mathbf{T}
are the parameters vectors of the susceptibility and transmissibility functions, respectively; \mathbf{X}
and \mathbf{Z}
are the susceptibility and transmissibility risk factor matrices, respectively; and \phi
and \xi
are vectors of the power parameters of the susceptibility and transmissibility functions, respectively. These power parameters allow for nonlinear relationships between the susceptibility and transmissibility risk factors and the infection rate (Deardon et al., 2010).
The infection kernel \kappa(i,j)
allows for distance (spatial) and/or contact network-based mechanisms. In distance-based models, the kernel function \kappa(i,j)
is a power-law or Cauchy function of distance. In network-based models, the kernel function \kappa(i,j)
is the contact network elements (binary (c_{ij}
) or weighted (w_{ij}
)). In both distance-network-based models, the kernel function \kappa(i,j)
is represented by two terms: (1) spatial function, and (2) the contact network.
The optional kernel function formulae are as follows:
-
Distance-based ILMs:
Power-law spatial kernel:
\kappa(i,j) = d_{ij}^{-\beta}
Cauchy spatial kernel:
\kappa(i,j) = \frac{\beta}{d_{ij}^{2}+\beta^{2}}
-
Network-based ILMs:
-
\kappa(i,j) = c_{ij}
for binary contact network or, -
\kappa(i,j) = w_{ij}
for weighted contact network.
-
-
Both distance- and network-based ILMs:
With power-law spatial kernel:
-
\kappa(i,j) = d_{ij}^{-\beta_{1}} +\beta_{2}c_{ij}
with binary contact network or, -
\kappa(i,j) = d_{ij}^{-\beta_{1}} +\beta_{2}w_{ij}
with weighted contact network.
-
With Cauchy spatial kernel:
-
\kappa(i,j) = \frac{\beta_{1}}{(d_{ij}^{2}+\beta_{1}^{2})} + \beta_{2}c_{ij}
with binary contact network or, -
\kappa(i,j) = \frac{\beta_{1}}{(d_{ij}^{2}+\beta_{1}^{2})} + \beta_{2}w_{ij}
with weighted contact network.
-
At time I_{s}
, the waiting time until being infected is drawn for each susceptible individual j
from W_{j} \sim Exp(\lambda_{jI_{s}})
. The individual with minimum W
is chosen as the next infected individual, and assigned infection time I_{s+1} = I_{s}+min(W_{j})
. Under SIR model, this newly-infected individual is also assigned an infectious period D_{j}
generated from the infectious period (exponential or gamma) distribution f(D_{j};\delta)
. Thus, its removal time becomes R_{s+1} = I_{s+1}+D_{j}
. Under SINR model, each infected individual is assigned an incubation period defining the time from infection to notification, and a delay period defining the time from notification to removal. Thus, this newly-infected individual is assigned an incubation and delay period D^{(inc)}_{j}
and D^{(delay)}_{j}
, generated from the (exponential or gamma) incubation and delay periods distributions f(D^{(inc)}_{j};\delta^{(inc)})
and f(D^{(delay)}_{j};\delta^{(delay)})
, respectively. Thus, its notification and removal times become N_{s+1} = I_{s+1}+D^{(inc)}_{j}
and R_{s+1} = N_{s+1}+D^{(delay)}_{j}
, respectively. The process is repeated until no infectives remain in the population, or until I_{s+1} >
tmax
if it is specified.
Value
The function datagen
returns objects of class “datagen” containing the following:
- type:
The specified type of the compartmental framework.
- kerneltype:
The specified type of the kernel function.
- epidat:
Under an SIR ILM, it is a matrix with four columns representing the id numbers of the individuals, removal times, infectious periods, and infection times, respectively. Under an SINR ILM, it is a matrix with six columns: the id numbers of the individuals, removal times, delay periods, notification times, incubation periods, and infection times. Uninfected individuals are assigned infinity values
(\infty)
for both their removal and infection times. Note that the rows ofepidat
is sorted according to the infection times in ascending order. The id numbers of the individuals is used here to respresnt the corresponding row number oflocation
, contactnetwork
, and covariate matrices.- location:
A matrix of the XY coordinates of individuals if it is given in the function, otherwise, a zero matrix.
- network:
The contact network matrix if it is given in the function.
References
Jewell, C. P., Kypraios, T., Neal, P., and Roberts, G. O. (2009). Bayesian analysis for emerging infectious diseases. Bayesian Analysis, 4(3):465-496.
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(1):239.
See Also
loglikelihoodepiILM, contactnet, plot.datagen
.
Examples
set.seed(3245)
loc<- matrix(cbind(runif(100, 1, 100),runif(100, 1, 100)), ncol = 2, nrow = 100)
net1<- contactnet(type = "powerlaw", location = loc, beta = 0.9)
cov <- cbind(rep(1, 100), runif(100, 1, 50))
#To simulate the epidemic using the network kernel:
epi.net <- datagen(type = "SIR", kerneltype = "network",
kernelmatrix = net1, suspar = c(0.08, 0.05),
delta = c(4, 2), suscov = cov)
#To simulate the epidemic using the distance kernel:
epi.dis <- datagen(type = "SIR", kerneltype = "distance",
distancekernel = "powerlaw", kernelmatrix = loc,
suspar = c(0.8, 0.5), kernel.par = 2,
delta = c(4, 2), suscov = cov)