Description Usage Arguments Value Examples
View source: R/draw_from_model.R
Based on a fully specified model of node membership vectors and Lambda matrix for average group pair connections, draws data from a bipartite SBM model and returns that data as a datafrom of each pair and the total number of connection seen for that pair.
1 2 | draw_from_model(b_a, b_b, Lambda, binary_connections = FALSE,
a_name = "a", b_name = "b")
|
b_a |
Group membership vector for the a nodes. See
|
b_b |
Group membership vectof for the b nodes |
Lambda |
Tibble containing average number of connections for each unique
pair of a and b node groups. See |
binary_connections |
Is data simple a yes or no connection? If |
a_name |
Name for the type a nodes in the output. |
b_name |
Name for the type b nodes in the output. |
A tibble with colums for ids of each node pair (a, b
), the groups
those node are in (a_group, b_group
), (avg_num_cons
) for the expected
number of connections from the Lambda
matrix and the number of edges
between those two pairs from model draw (num_edges
).
1 2 3 4 5 6 7 8 9 10 | N_a <- 15 # Number of nodes of the a type
N_b <- 10 # Number of nodes of the b type
K_a <- 4 # How many blocks of a type nodes are there
K_b <- 3 # How many blocks of the b type nodes are there
draw_from_model(
assign_group_membership(N = N_a, K = K_a),
assign_group_membership(N = N_b, K = K_b),
Lambda = generate_random_lambda(K_a = K_a, K_b = K_b)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.