View source: R/SimulateDyadicLinearERGM.R
SimulateDyadicLinearERGM | R Documentation |
Simulates a random ERGM network using a given matrix of covariate values and a corresponding vector of parameter values.
SimulateDyadicLinearERGM(N, dyadiccovmat, eta)
N |
number of individuals in the population. |
dyadiccovmat |
matrix of dyadic covariates. |
eta |
vector of parameters. |
dyadiccovmat is an {N \choose 2}
by (k+2)
matrix containing the dyadic covariates for the population, where N
is the number of individuals in the population and k
is the number of dyadic covariates used in the model. The matrix contains one row for each dyad (pair of nodes). Columns 1 and 2 give the ID of the two nodes comprising the dyad, and the remaining k
columns give the covariate values; eta is the vector of parameters corresponding to the covariates.
For this class of dyadic independence network, the probability of an edge between individuals i
and j
is p_{\{i,j\} }
, where
\log \left( \frac{p_{\{i,j\} }}{1-p_{\{i,j\} }} \right) = \sum_{k} \eta_k X_{\{i,j\},k}
More information about this type of model can be found in Groendyke et al. (2012).
a network in edgelist matrix format
David Welch david.welch@auckland.ac.nz, Chris Groendyke cgroendyke@gmail.com
Groendyke, C., Welch, D. and Hunter, D. 2012. A Network-based Analysis of the 1861 Hagelloch Measles Data, Biometrics, 68-3.
SEIR.simulator
for simulating an SEIR epidemic over a network.
# Construct a network of 30 individuals
set.seed(3)
N <- 30
# Build dyadic covariate matrix
# Have a single covariate for overall edge density; this is the Erdos-Renyi model
nodecov <- matrix(1:N, nrow = N)
dcm <- BuildX(nodecov)
# Simulate network
examplenet <- SimulateDyadicLinearERGM(N, dyadiccovmat = dcm, eta = -1.8)
# Another example
set.seed(1)
N <- 50
mycov <- data.frame(id = 1:N, xpos = runif(N), ypos = runif(N))
dyadCov <- BuildX(mycov, binaryCol = list(c(2, 3)),binaryFunc = c("euclidean"))
# Build network
eta <- c(0,-7)
net <- SimulateDyadicLinearERGM(N = N, dyadiccovmat = dyadCov, eta = eta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.