Collection of Normal-Block Models over a Sparsity Path
Source:R/NormalBlockVarCollectionSparsity.R
NormalBlockVarCollectionSparsity.RdR6 class for a collection of normal-block models with a fixed clustering (blocks) and different sparsity levels.
Super classes
NormalBlockCollection -> NormalBlockCollectionSparsity -> NormalBlockVarCollectionSparsity
Active bindings
sparsity_detailslist of information about model's penalties
criteriaa data frame with the values of some criteria ((approximated) log-likelihood, BIC) for the collection of models
stability_pathmeasure of edges stability based on StARS method
stabilitymean edge stability along the sparsity penalties path
who_am_Ia method to print what model is being fitted
Methods
NormalBlockVarCollectionSparsity$new()
Create a new [`NormalBlockVarCollectionSparsity`] object.
Usage
NormalBlockVarCollectionSparsity$new(
mydata,
blocks,
zero_inflation = FALSE,
control = NB_control()
)Arguments
mydataobject of NormalBlockData class, with responses and design matrix
blockseither a clustering matrix (known, fixed clustering) or a single integer (number of blocks to infer)
zero_inflationboolean to specify whether data is zero-inflated
controlstructured list of parameters to handle sparsity control
NormalBlockVarCollectionSparsity$get_best_model()
Extract best model in the collection
Usage
NormalBlockVarCollectionSparsity$get_best_model(
crit = c("BIC", "EBIC", "ICL", "StARS"),
stability = 0.9
)NormalBlockVarCollectionSparsity$stability_selection()
Compute the stability path by stability selection
Arguments
subsamplesa list of vectors describing the subsamples. The number of vectors (or list length) determines the number of subsamples used in the stability selection. Automatically set to 20 subsamples with size `10*sqrt(n)` if `n >= 144` and `0.8*n` otherwise following Liu et al. (2010) recommendations.
n_subsamplesnumber of subsamples to create if the subsamples are not given
Examples
ex <- generate_normal_block_var_data(n = 50, p = 20, d = 1, q = 3)
data <- NormalBlockData$new(ex$Y, ex$X)
models <- normal_block(data, blocks = ex$parameters$C, sparsity = TRUE,
control = NB_control(verbose = FALSE, n_sparsity_penalties = 5))
models$get_best_model("BIC")$sparsity
#> [1] 0.001058849