Skip to contents

This function implements bootstrap stability selection for choosing the optimal number of clusters K. It assesses the stability of cluster assignments across bootstrap resamples and selects K that produces the most stable clustering.

Usage

select_K_bootstrap_stability(
  list_of_data,
  Kvec = 2:5,
  r = 2,
  B = 50,
  subsample_ratio = 0.8,
  max_iter = 50,
  n_init = 1,
  model_type = c("MFA", "MPCA"),
  verbose = TRUE
)

Arguments

list_of_data

A list of data matrices, each (T_i x M).

Kvec

Vector of candidate K values to test.

r

Number of factors (fixed).

B

Number of bootstrap iterations (default: 50).

subsample_ratio

Proportion of subjects to sample (default: 0.8).

max_iter

Maximum EM iterations per fit.

n_init

Number of random initializations per fit.

model_type

Either "MFA" or "MPCA" (default: "MFA").

verbose

Print progress messages (default: TRUE).

Value

A list containing:

best_K

The selected optimal K based on stability

stability_scores

Stability score for each K

stability_df

Data frame with K and stability scores

Details

The stability selection procedure: 1. For each candidate K, perform B bootstrap iterations 2. In each iteration, subsample subjects and fit the model 3. Compute pairwise co-clustering matrix (1 if subjects i,j in same cluster) 4. Average co-clustering matrices across bootstrap samples 5. Compute stability score as mean of (max probability per subject - 1/K) 6. Select K with highest stability score

Higher stability indicates more consistent cluster assignments across resamples.

References

Ben-Hur, A., Elisseeff, A., & Guyon, I. (2001). A stability based method for discovering structure in clustered data. Pacific Symposium on Biocomputing.