Collection of Mean-Block Models over a Range of Cluster Counts
Source:R/NormalBlockMeanCollectionClusters.R
NormalBlockMeanCollectionClusters.RdR6 class for a collection of mean-block models ([NormalBlockMeanBase]) with different numbers of clusters (q). Inherits its scaffolding (`print()`/`summary()`/`plot()`/`optimize()`, the `criteria` table) from [NormalBlockCollection]. Unlike [NormalBlockVarCollectionClusters], there is no SBM-path shortcut here: the shared clustering-heuristic registry's cov()/correlation-based methods are ill-suited to the mean-block family (see [NormalBlockMeanBase]'s own default), so each q is fit independently.
Super classes
NormalBlockCollection -> NormalBlockCollectionClusters -> NormalBlockMeanCollectionClusters
Methods
NormalBlockMeanCollectionClusters$new()
Create a new [`NormalBlockMeanCollectionClusters`] object.
Usage
NormalBlockMeanCollectionClusters$new(
mydata,
q_list,
zero_inflation = FALSE,
sparsity = 0,
control = NB_control()
)Arguments
mydataobject of NormalBlockData class, with responses and design matrix
q_listlist of q values (number of groups) in the collection
zero_inflationwhether Y carries structural zeros; every model in the collection is then zero-inflated (Sigma diagonal or spherical only, see [NormalBlockMeanBase])
sparsitysparsity penalty on the network density
controlstructured list of more specific parameters, to generate with NB_control
Examples
ex <- generate_normal_block_mean_data(n = 50, p = 20, d = 1, q = 3)
data <- NormalBlockData$new(ex$Y, ex$X)
models <- normal_block(data, blocks = 2:5, model = "mean")
#> Fitting a normal-block-mean model with unknown q
#> number of blocks = 2
number of blocks = 3
number of blocks = 4
number of blocks = 5
#> DONE
models$plot(c("BIC", "ICL"))
models$get_best_model()
#> A diagonal normal-block-mean model with 2 unknown blocks .
#> ===========================================================================
#> nb_param q n_edges sparsity loglik deviance BIC ICL EBIC niter
#> 23 2 0 0 -963.653 1927.305 2017.282 2017.282 2017.282 3
#> ===========================================================================
#> * Useful fields
#> $model_par, $posterior_par / $var_par, $clustering
#> $loglik, $BIC, $ICL, $objective, $nb_param, $criteria
#> * Useful S3 methods
#> print(), summary(), plot(), coef(), sigma(), fitted(), predict()