Fit Bayesian stochastic block models (SBMs) and multi-level stochastic block models (MLSBMs) using efficient Gibbs sampling implemented in 'Rcpp'. The models assume symmetric, non-reflexive graphs (no self-loops) with unweighted, binary edges. Data are input as a symmetric binary adjacency matrix (SBMs), or list of such matrices (MLSBMs).
The mlsbm package fits single level stochastic block models (SBMs) and multilevel stochastic block models (MLSBMs) using efficient Gibbs sampling with Rcpp. It can also be used to efficiently sample from SBMs and MLSBMs.
The mlsbm package can be installed directly from this repository using devtools.
devtools::install_github("carter-allen/mlsbm")
# load mlsbm package
library(mlsbm)
# load included 3-layer network data
data(AL)
# fit a multilevel SBM with 3 clusters
fit <- fit_mlsbm(AL,3)
# examine the inferred clustering
table(fit$z)