Draw a Simulation of Network Using Block Matrix of Probabilities of Edges Based on Group Memberships

sim_block_network(
  N,
  K,
  prev_K,
  rho_K,
  p_edge_within,
  p_edge_between,
  directed = FALSE
)

Arguments

N

number of units in population

K

number of groups

prev_K

named numeric vector of prevalence for each group with last group being hidden

rho_K

numeric vector of correlations in group memberships

p_edge_within

named list of numeric vectors giving probability of link between in-group members and out-group members for each of groups. The order of objects in list have to follow the order of prev_K

p_edge_between

named list of numeric values giving probability of link between in- and out-group member for each of groups. The order of objects in list have to follow the order of prev_K

directed

logical, whether links are directed or undirected

Value

igraph network object with vertex attribute type in the binary coded format (consists of 0's and 1's only)

Examples

if (FALSE) {
 sim_block_network(N = 2000, K = 3,
                   prev_K = c(frame = .7,
                              known = .2,
                              hidden = .05),
                   rho_K = c(.05, .01, .01),
                   p_edge_within =
                     list(frame = c(.3,.3),
                          known = c(.3,.3),
                          hidden = c(.3,.9)),
                   p_edge_between =
                     list(frame = 0.3,
                          known = 0.3,
                          hidden = 0.05),
                   directed = FALSE)
}