A collection of tools and functions to adjust a variety of stochastic blockmodels (SBM).
Supports at the moment Simple, Bipartite, 'Multipartite' and Multiplex SBM (undirected or directed with Bernoulli, Poisson or Gaussian emission laws on the edges). For Simple and Bipartite SBM, covariates can be given on the edges, or on the nodes to drive the block memberships, and the network may contain missing values. See Léger (2016)
sbm gathers in a single framework the tools to simulate, estimate and represent a variety of stochastic block models (SBM), a family of models that cluster the nodes of a network into blocks sharing the same connectivity patterns.
| Network | Function | Estimation engine |
|---|---|---|
| Simple (one set of nodes, directed or not) | estimateSimpleSBM() |
blockmodels |
| Bipartite (two sets of nodes) | estimateBipartiteSBM() |
blockmodels |
| Multipartite (several sets of nodes and networks) | estimateMultipartiteSBM() |
GREMLINS |
| Multiplex (several networks on the same nodes) | estimateMultiplexSBM() |
GREMLINS (independent layers), blockmodels (dependent layers) |
NA) in the networks: the missing dyads are
ignored in the inference (see the help pages for the details of each
model).sampleSimpleSBM(),
sampleBipartiteSBM(), sampleMultipartiteSBM() and
sampleMultiplexSBM().The stable version is available on CRAN:
install.packages("sbm")
The development version can be installed from GitHub:
# install.packages("pak")
pak::pak("GrossSBM/sbm")
The data set fungusTreeNetwork records the interactions between 154
fungal species and 51 tree species. A bipartite SBM groups the fungi and
the trees into blocks sharing the same interaction patterns, the number
of blocks being chosen with the ICL.
library(sbm)
data("fungusTreeNetwork")
fungusTree <- fungusTreeNetwork$fungus_tree
fit <- estimateBipartiteSBM(
fungusTree, model = "bernoulli", dimLabels = c(row = "fungus", col = "tree"),
estimOptions = list(verbosity = 0, plot = FALSE, nbCores = 1)
)
fit$nbBlocks
#> fungus tree
#> 4 4
library(patchwork)
plot(fit, type = "data") + plot(fit, type = "meso")
The vignettes go further: model principles, case studies on simple, bipartite, multipartite and multiplex networks, and covariates on the nodes.