# draw_from_model: Draw data from model In tbilab/BiSBMSim: Simulate Data From Bipartite Stochastic Block Model

## Description

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.

## Usage

 ```1 2``` ```draw_from_model(b_a, b_b, Lambda, binary_connections = FALSE, a_name = "a", b_name = "b") ```

## Arguments

 `b_a` Group membership vector for the a nodes. See `assign_group_membership()` for more details on format. `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 `generate_random_lambda()` for more details. `binary_connections` Is data simple a yes or no connection? If `FALSE`, function defaults to treating `Lambda` matrix values as mean for Poisson distribution, otherwise `Lambda` values are interpreted as the probability of connection using a bernouli distribution. Defaults to `FALSE`. `a_name` Name for the type a nodes in the output. `b_name` Name for the type b nodes in the output.

## Value

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`).

## Examples

 ``` 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) ) ```

tbilab/BiSBMSim documentation built on Nov. 5, 2019, 10:01 a.m.