contactnet {EpiILMCT} | R Documentation |
Generate binary adjacency matrix contact networks
Description
This function allows the user to generate contact network with binary adjacency matrices from spatial (power-law or Cauchy) and random network models.
Usage
contactnet(type, num.id = NULL, location = NULL, beta, nu = NULL)
Arguments
type |
type of contact network model, with the choice of “powerlaw” for the power-law model, “Cauchy” for the Cauchy model, and “random” for randomly generated contact network from a Bernoulli distribution with parameter beta. |
num.id |
the number of individuals (nodes). It has to be specified when |
location |
a matrix of the XY coordinates of individuals. Required when |
beta |
spatial parameter of the spatial contact network model or probability parameter of the random network model (>0). |
nu |
scale parameter of the power-law contact network model (>0). Default value is 1. |
Details
The contact networks considered here are undirected, “unweighted” and have binary adjacency matrix, so that for
, and each element of the contact network is defined as
if a connection exist between individuals
and
, and 0 otherwise. We can either generate spatial networks which have connections more likely to be present between two individuals closed together than far apart, or random contact networks.
For spatial contact networks, there are two options of specifying the model for the probability of connections between individuals. We use a generalized version of the power-law contact network model of Bifolchi et al. (2013) for the first option, in which
the probability of a connection between individuals and
is given by:
where is the Euclidean distance between individuals
and
;
is the spatial parameter; and
is the scale parameter.
The second option is a Cauchy model as used in Jewell et al., (2009). The probability of a connection between individuals and
is given by:
where is the Euclidean distance between individual
and
; and
is the spatial parameter.
The final option is a random contact network in which the probability of a connection is generated from a Bernoulli distribution with probability equal to .
Value
An object of class “contactnet” that has a list of:
- location:
A matrix of the XY coordinates of individuals.
- contact.network:
Binary contact network adjacency matrix.
- type:
The type of contact network model.
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.
Bifolchi, N., Deardon, R., and Feng, Z. (2013). Spatial approximations of network-based individual level infectious disease models. Spatial and Spatio-temporal Epidemiology, 6:59-70.
Examples
set.seed(12345)
loc<- matrix(cbind(runif(50, 0, 10),runif(50, 0, 10)), ncol = 2, nrow = 50)
net1<- contactnet(type = "powerlaw", location = loc, beta = 1.5, nu = 0.5)
net2<- contactnet(type = "Cauchy", location = loc, beta = 0.5)
net3<- contactnet(type = "random", num.id = 50, beta = 0.08)