simulate_mlnet {mlergm} | R Documentation |
Simulate a multilevel network
Description
Function simulates a multilevel network by specifying a network size, node block memberships, and within-block and between-block models. The function currently only suppports block-models where between-block edges are dyad-independent.
Usage
simulate_mlnet(
form,
node_memb,
theta,
parameterization = "standard",
seed = NULL,
between_form = NULL,
between_theta = NULL,
between_prob = NULL,
options = set_options()
)
Arguments
form |
A |
node_memb |
Vector of node block memberships. |
theta |
A vector of model parameters (coefficients) for the ERGM governing the within-subgraph edges. |
parameterization |
Parameterization options include 'standard', 'offset', or 'size'.
|
seed |
Seed to be provided for reproducibility. |
between_form |
A |
between_theta |
A vector of model parameters (coefficients) for the ERGM governing the between-subgraph edges. |
between_prob |
A probability which specifies how edges between blocks are governerd. An ERGM ( |
options |
Use |
Details
Simulation of multilevel block networks is done with a Monte-Carlo Markov chain (MCMC) and can be done in parallel where set_options
can be used to adjust the simulation settings (such as burnin
, interval
, and sample_size
). Each within-block subgraph is given its own Markov chain, and so these settings are the settings to be used for each within-block chain.
Value
simulate_mlnet
returns an objects of class mlnet
.
Examples
# Create a K = 2 block network with edge + gwesp term
net <- simulate_mlnet(form = network.initialize(30, directed = FALSE) ~ edges + gwesp,
node_memb = c(rep(1, 15), rep(2, 15)),
theta = c(-3, 0.5, 1.0),
between_prob = 0.01,
options = set_options(number_cores = 2, burnin = 2000))
# Simulate a K = 2 block directed network, specifying a formula for between edges
net <- simulate_mlnet(form = network.initialize(30, directed = TRUE) ~ edges + gwesp,
node_memb = c(rep(1, 15), rep(2, 15)),
theta = c(-3, 0.5, 1.0),
between_form = ~ edges + mutual,
between_theta = c(-4, 2),
options = set_options(number_cores = 2, burnin = 2000))