Base Class for a Collection of Models over a Range of Cluster Counts
Source:R/NormalBlockCollectionClusters.R
NormalBlockCollectionClusters.RdShared scaffolding for [NormalBlockVarCollectionClusters] and [NormalBlockMeanCollectionClusters]: everything that does not depend on the model family (model lookup, model selection, the criteria plot and the split/merge `refine()` search). Concrete subclasses only build `self$models` in their `initialize()` and name themselves through `who_am_I`.
Super class
NormalBlockCollection -> NormalBlockCollectionClusters
Methods
Inherited methods
NormalBlockCollectionClusters$get_model()
returns the unknown-clusters model corresponding to given q
NormalBlockCollectionClusters$get_best_model()
Extract best model in the collection
Usage
NormalBlockCollectionClusters$get_best_model(
crit = c("ICL", "BIC", "EBIC", "deviance")
)NormalBlockCollectionClusters$plot()
Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of network fits (a [`Networkfamily`])
Usage
NormalBlockCollectionClusters$plot(
criteria = c("deviance", "ICL", "BIC", "EBIC")
)NormalBlockCollectionClusters$optimize()
optimizes every model in the collection, then – if `control$refine` is `TRUE` (see [NB_control()], default `FALSE`) – calls [refine()] automatically.
Usage
NormalBlockCollectionClusters$optimize(
control = list(niter = 500, threshold = 1e-04, verbose = TRUE)
)NormalBlockCollectionClusters$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
NormalBlockCollectionClusters$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()]).