Collection of Normal-Block Models over a Range of Cluster Counts
Source:R/NormalBlockVarCollectionClusters.R
NormalBlockVarCollectionClusters.RdR6 class for a collection of normal-block models with different number of clusters (q) and a fixed sparsity level.
Super class
NormalBlockVarCollection -> NormalBlockVarCollectionClusters
Methods
Inherited methods
NormalBlockVarCollectionClusters$new()
Create a new [`NormalBlockVarCollectionClusters`] object.
Usage
NormalBlockVarCollectionClusters$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 the models in the collection should be zero-inflated or not
sparsitysparsity penalty on the network density
controlstructured list of more specific parameters, to generate with NB_control
NormalBlockVarCollectionClusters$get_model()
returns the NormalBlockVarUnknownClusters model corresponding to given q
NormalBlockVarCollectionClusters$get_best_model()
Extract best model in the collection
Usage
NormalBlockVarCollectionClusters$get_best_model(
crit = c("ICL", "BIC", "EBIC", "deviance")
)NormalBlockVarCollectionClusters$plot()
Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of network fits (a [`Networkfamily`])
Usage
NormalBlockVarCollectionClusters$plot(
criteria = c("deviance", "ICL", "BIC", "EBIC")
)NormalBlockVarCollectionClusters$optimize()
optimizes every model in the collection, then – if `control$refine` is `TRUE` (see [NB_control()], default `FALSE`) – calls [refine()] automatically.
Usage
NormalBlockVarCollectionClusters$optimize(
control = list(niter = 500, threshold = 1e-04, verbose = TRUE)
)NormalBlockVarCollectionClusters$refine()
Tries to improve every model in the collection with a short split-and-reoptimize trial seeded from its smaller-q neighbor (`"split"`), a short merge-and-reoptimize trial seeded from its larger-q neighbor (`"merge"`), or both (the default); a candidate replaces the original only if it strictly lowers the deviance, so this can only improve (or leave unchanged) each model it touches. Only contiguous q pairs (`q` and `q -/+ 1`, both present in the collection) are refined. See `inst/methods_initialization_and_refine.md` for the rationale and empirical evidence.
Usage
NormalBlockVarCollectionClusters$refine(
trial_niter = 2,
max_candidates = 30,
directions = c("split", "merge"),
verbose = self$control$verbose
)Arguments
trial_niternumber of EM iterations used for the cheap trial candidates (passed to `candidates_split()`/`candidates_merge()`) before fully re-optimizing only the best one.
max_candidatespassed to `candidates_merge()` (ignored for `"split"`, which is never combinatorial in q) – see its documentation.
directionswhich neighbor(s) to seed refinement candidates from: `"split"` (smaller-q neighbor), `"merge"` (larger-q neighbor), or both (the default).
verbosewhether to print, for each q attempted, whether the candidate from that neighbor improved on it. Defaults to `control$verbose` (the value set at construction, see [NB_control()]).