Implements the stability-driven hierarchical clustering framework for multi-endpoint patient phenotyping described in Roy Chowdhury et al., "A stability-driven hierarchical clustering framework for multi-endpoint patient phenotyping in oncology" (submitted to Computers in Biology and Medicine). Provides survival feature-space embedding for multiple time-to-event endpoints, a competing-risks data-generating mechanism for simulation, an exhaustive sweep over valid distance-linkage-K configurations, bootstrap Jaccard cluster-stability assessment, a chaining- artefact diagnostic (Delta_CA), cluster-number selection combining silhouette width, the gap statistic and bootstrap stability, and benchmarking against k-means and Gaussian mixture models.
Stability-driven hierarchical clustering for multi-endpoint survival phenotyping in R, implementing the framework from Roy Chowdhury et al., "A stability-driven hierarchical clustering framework for multi-endpoint patient phenotyping in oncology: methodological evaluation and real-data application" (submitted to Computers in Biology and Medicine, CIBM-S-26-03855).
# install.packages("devtools")
devtools::install_local("survPhenoStab_0.1.0.tar.gz")
| Function | Status |
|---|---|
embed_survival() |
ported from the manuscript's feature-space embedding (Eq. 2) |
sim_competing_risks() |
ported from run_mc_python.py::gen_dataset() |
cosine_dist(), cluster_assign(), cluster_configs() |
ported from run_mc_python.py::cosine_dist_matrix() / cluster_and_assign(); Manhattan distance is added here (see caveat below) |
boot_jaccard(), jaccard_per_cluster() |
ported from jmin_for_config() / jaccard_per_cluster() |
silhouette_width() |
ported from silhouette_score() |
logrank_test() |
ported from logrank_chisq() |
chaining_diagnostic() |
new — Delta_CA = ARI - J_min (Eq. 5), using mclust::adjustedRandIndex() for ARI, which had no implementation in the supplied code |
select_k() |
new — silhouette + gap statistic (cluster::clusGap, one-SE rule) + bootstrap stability curve + 5% minimum cluster size (Section 2.5.5), which had no implementation in the supplied code |
benchmark_methods() |
new — k-means / Gaussian mixture (mclust::Mclust) / Ward-Euclidean comparison (Section 5, Table 6), which had no implementation in the supplied code |
mc_replicate() |
ported from run_mc_python.py's one_replicate() + main loop |
Manhattan distance has no corresponding code in the CBM_Submission
zip. cluster_and_assign() in run_mc_python.py only implements
'cosine' and 'euclidean' (it raises ValueError on anything else),
yet the manuscript's Table 2 reports concrete Manhattan-distance rows,
and Table 2's own footnote states those values (and the single-linkage
rows) were "interpolated by their relative ordering at B = 100 sweeps
and should be re-run at B = 500 for the final submission." This
package's cluster_assign() does implement Manhattan distance
(stats::dist(method = "manhattan")), so it can be used to actually
compute what the manuscript currently reports as interpolated.
The "9 valid distance-linkage combinations" / "27 configurations"
arithmetic does not follow from the manuscript's own stated
restriction. Section 2.4 states Ward.D2 is "not combined with
non-Euclidean metrics." With 3 distances x 3 linkages (Ward.D2,
complete, average), excluding Ward.D2 from both Manhattan and cosine
leaves 7 valid pairs, not 9 (9 - 2 = 7), i.e. 21 configurations, not
27. cluster_configs() implements the mathematically consistent
7-pair / 21-configuration grid and documents the discrepancy inline.
Both are worth checking against your LaTeX source before the next revision — independent of the novelty concerns already being addressed.
tests/testthat/).library(survPhenoStab)
mc <- mc_replicate(M = 200, n = 518, B = 200, base_seed = 1000)
mc # compare against mean Delta J_min = 0.152, 88% positive
plot(mc) # reproduces Figure 2
See vignette("survPhenoStab-intro") for a full walk-through.