Function for summarizing the sampled cluster allocation vectors
Source:R/posterior_utils.R
summarySBM.Rd
Th summarySBM
function summarizes the sampled allocation vectors from
each iteration of the Gibbs sampler from the output of the bgm
function ran with edge_prior = "Stochastic-Block"
and
save = TRUE
. It also estimates the posterior distribution of the
number of clusters.
Value
Returns a list of two elements: components
and allocations
,
containing the posterior probabilities for the number of components (clusters)
and the estimated cluster allocation of the nodes using Dahl's method.
Examples
# \donttest{
# fit a model with the SBM prior
bgm_object = bgm(
Wenchuan[, c(1:5)],
edge_prior = "Stochastic-Block",
save = TRUE)
#> Warning: There were 7 rows with missing observations in the input matrix x.
#> Since na_action = listwise these rows were excluded from the analysis.
summarySBM(bgm_object)
#> $components
#> num_components probability
#> [1,] 1 0.683038670
#> [2,] 2 0.242103696
#> [3,] 3 0.060658230
#> [4,] 4 0.012086772
#> [5,] 5 0.002112631
#>
#> $allocations
#> [1] 1 1 1 1 1
#>
# }