Skip to contents

R6 class for a collection of normal-block models with different number of clusters (q) and different sparsity levels.

Super classes

NormalBlockCollection -> NormalBlockCollectionClustersSparsity -> NormalBlockVarCollectionClustersSparsity

Active bindings

who_am_I

a method to print what model is being fitted

Methods

Inherited methods


NormalBlockVarCollectionClustersSparsity$new()

Create a new [`NormalBlockVarCollectionClustersSparsity`] object.

Usage

NormalBlockVarCollectionClustersSparsity$new(
  mydata,
  q_list,
  zero_inflation = FALSE,
  control = NB_control()
)

Arguments

mydata

object of NormalBlockData class, with responses and design matrix

q_list

list of q values (number of groups) in the collection

zero_inflation

boolean to specify whether data is zero-inflated

control

structured list of parameters to handle sparsity control

Returns

A new [`NormalBlockVarCollectionClustersSparsity`] object


NormalBlockVarCollectionClustersSparsity$clone()

The objects of this class are cloneable with this method.

Usage

NormalBlockVarCollectionClustersSparsity$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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 = 2:3, sparsity = TRUE,
                       control = NB_control(verbose = FALSE, n_sparsity_penalties = 3))
models$get_best_model("BIC")$q
#> [1] 3