An S4 class to represent a Stochastic Block Model. Such model can be used to cluster graph vertex, and model a square adjacency matrix \(X\) with the following generative model : $$ \pi \sim Dirichlet(\alpha)$$ $$ Z_i \sim \mathcal{M}(1,\pi)$$ $$ \theta_{kl} \sim Beta(a_0,b_0)$$ $$ X_{ij}|Z_{ik}Z_{jl}=1 \sim \mathcal{B}(\theta_{kl})$$ These classes mainly store the prior parameters value \(\alpha,a_0,b_0\) of this generative model. The Sbm-class must be used when fitting a simple Sbm whereas the SbmPrior-class must be used when fitting a MixedModels-class.

SbmPrior(a0 = 1, b0 = 1, type = "guess")

Sbm(alpha = 1, a0 = 1, b0 = 1, type = "guess")

Arguments

a0

Beta prior parameter over links (default to 1)

b0

Beta prior parameter over no-links (default to 1)

type

define the type of networks (either "directed", "undirected" or "guess", default to "guess"), for undirected graphs the adjacency matrix is supposed to be symmetric.

alpha

Dirichlet prior parameter over the cluster proportions (default to 1)

Value

a SbmPrior-class object a Sbm-class object

Functions

  • Sbm-class: Sbm class constructor

  • SbmPrior: SbmPrior class constructor

  • Sbm: Sbm class constructor

Slots

a0

Beta prior parameter over links (default to 1)

b0

Beta prior parameter over no-links (default to 1)

type

define the type of networks (either "directed", "undirected" or "guess", default to "guess"), for undirected graphs the adjacency matrix is supposed to be symmetric.

alpha

Dirichlet prior parameter over the cluster proportions (default to 1)

References

Nowicki, Krzysztof and Tom A B Snijders (2001). “Estimation and prediction for stochastic block structures”. In:Journal of the American statistical association 96.455, pp. 1077–1087

Examples

Sbm()
#> An object of class "Sbm"
#> Slot "alpha":
#> [1] 1
#> 
#> Slot "a0":
#> [1] 1
#> 
#> Slot "b0":
#> [1] 1
#> 
#> Slot "type":
#> [1] "guess"
#> 
sbm <- rsbm(100, c(0.5, 0.5), diag(2) * 0.1 + 0.01)
sol <- greed(sbm$x, model = Sbm(a0 = 0.5, b0 = 0.5, alpha = 0.5))
#> ------- guess SBM model fitting ------
#> ################# Generation  1: best solution with an ICL of -2104 and 3 clusters #################
#> ################# Generation  2: best solution with an ICL of -2091 and 2 clusters #################
#> ################# Generation  3: best solution with an ICL of -2091 and 2 clusters #################
#> ------- Final clustering -------
#> ICL clustering with a SBM model, 2 clusters and an icl of -2091.
SbmPrior()
#> An object of class "SbmPrior"
#> Slot "a0":
#> [1] 1
#> 
#> Slot "b0":
#> [1] 1
#> 
#> Slot "type":
#> [1] "guess"
#> 
SbmPrior(type = "undirected")
#> An object of class "SbmPrior"
#> Slot "a0":
#> [1] 1
#> 
#> Slot "b0":
#> [1] 1
#> 
#> Slot "type":
#> [1] "undirected"
#> 
Sbm()
#> An object of class "Sbm"
#> Slot "alpha":
#> [1] 1
#> 
#> Slot "a0":
#> [1] 1
#> 
#> Slot "b0":
#> [1] 1
#> 
#> Slot "type":
#> [1] "guess"
#> 
Sbm(type = "undirected")
#> An object of class "Sbm"
#> Slot "alpha":
#> [1] 1
#> 
#> Slot "a0":
#> [1] 1
#> 
#> Slot "b0":
#> [1] 1
#> 
#> Slot "type":
#> [1] "undirected"
#>