simulate_lbm {robber}R Documentation

Simulate a bipartite interaction network using block model

Description

Simulate a bipartite interaction network using block model

Usage

simulate_lbm(con, pi, rho, nr, nc, method = "gnp")

Arguments

con

A matrix, the connectivity between blocks. If method = "gnp" then each entry is the probability of interactions given 2 blocks. If method = "gnm" then each entry is the number of interactions between 2 blocks.

pi

A vector of the same length as nrow(con), the block mixture for the row species. If method = "gnp", then pi is a probability vector, if method = "gnm", then pi is the number of species per block, must sum to nr.

rho

A vector of the same length as ncol(con), the block mixture for the column species. If method = "gnm", then rho is a probability vector, if method = "gnm", then rho is the number of species per block, must sum to nc.

nr

The number of row Species

nc

The number of column Species

method

One of "gnp" (the default) where the blocks size and number of interactions is random and "gnm" where the blocks size and number of interactions are fixed.

Value

A list of 3 elements:

Examples

# For a random number of interactions and blocks sizes
con <- matrix(c(.5,.3,.3,.1), 2, 2)
pi  <- c(.25,.75)
rho <- c(1/3, 2/3)
nr <- 50
nc <- 30
simulate_lbm(con, pi, rho, nr, nc, method = "gnp")

# For a fixed number of ineractions and blocks sizes
con <- matrix(c(50, 120, 60, 80), 2, 2)
pi  <- c(10, 40)
rho <- c(10, 20)
nr <- 50
nc <- 30
simulate_lbm(con, pi, rho, nr, nc, method = "gnm")

[Package robber version 0.2.4 Index]