View source: R/generalize-userfunction.R
mlvsbm_create_generalized_network | R Documentation |
Create a GenMLVSBM object from observed data
mlvsbm_create_generalized_network(X, A, directed = NULL, distribution = NULL)
X |
A list of |
A |
A list of |
directed |
A vector of L booleans are the levels directed or not. Default will check if the matrix are symmetric or not. |
distribution |
A vector of length L, the distribution of X, only "bernoulli" and "poisson" are implemented. |
An unfitted MLVSBM object corresponding to the multilevel network
# A standard binary 2 levels multilevel network
ind_adj <- matrix(stats::rbinom(n = 20**2, size = 1, prob = .2),
nrow = 20, ncol = 20)
diag(ind_adj) <- 0
org_adj <- matrix(stats::rbinom(n = 10**2, size = 1, prob = .3),
nrow = 10, ncol = 10)
diag(org_adj) <- 0
affiliation <- matrix(0, 20, 10)
affiliation[cbind(seq(20), sample(seq(10), 20, replace = TRUE))] <- 1
my_mlvsbm <- mlvsbm_create_generalized_network(X = list(org_adj, ind_adj),
directed = c(TRUE, TRUE),
A = list(affiliation),
distribution = rep("bernoulli", 2))
# A 4 levels temporal network with the same nodes and with count data.
#All the affiliation matrices are diagonal.
X <- replicate(4,
matrix(stats::rpois(n = 20*20, lambda = .7), 20, 20),
simplify = FALSE)
for (m in seq(4)) {diag(X[[m]]) <- 0}
A <- replicate(3, diag(1, 20), simplify = FALSE)
my_mlvsbm <- mlvsbm_create_generalized_network(X = X,
directed = rep(4, TRUE),
A = A,
distribution = rep("poisson", 4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.