fit_mlsbm: R/Rcpp function for fitting multilevel stochastic block model

View source: R/fit_mlsbm.R

fit_mlsbmR Documentation

R/Rcpp function for fitting multilevel stochastic block model

Description

This function allows you to fit multilevel stochastic block models.

Usage

fit_mlsbm(
  A,
  K,
  z_init = NULL,
  a0 = 2,
  b10 = 1,
  b20 = 1,
  n_iter = 1000,
  burn = 100,
  verbose = FALSE,
  r = 1.2
)

Arguments

A

An adjacency list of length L, the number of levels. Each level contains an n x n symmetric adjacency matrix.

K

The number of clusters specified a priori.

z_init

Initialized cluster indicators. If NULL, will initialize automatically with Louvain algorithm.

a0

Dirichlet prior parameter for cluster sizes for clusters 1,...,K.

b10

Beta distribution prior paramter for community connectivity.

b20

Beta distribution prior parameter for community connectivity.

n_iter

The number of total MCMC iterations to run.

burn

The number of burn-in MCMC iterations to discard. The number of saved iterations will be n_iter - burn.

verbose

Whether to print a progress bar to track MCMC progress. Defaults to true.

r

Resolution parameter for Louvain initialization. Sould be >= 0 and higher values give a larger number of smaller clusters.

Value

A list of MCMC samples, including the MAP estimate of cluster indicators (z)

Examples

data(AL)
# increase n_iter in practice
fit <- fit_mlsbm(AL,3,n_iter = 100)

carter-allen/mlsbm documentation built on March 19, 2022, 8:26 a.m.