Initial release, companion package to 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).
CBM_Submission/code/)embed_survival() — multi-endpoint survival
feature-space embedding (Eq. 2)sim_competing_risks() — competing-risks data-generating
mechanism (Section 2.1, Eq. 1)cosine_dist(), cluster_assign(),
cluster_configs() — distance/linkage/K sweep (Section
2.4)boot_jaccard(), jaccard_per_cluster() —
bootstrap Jaccard stability (Section 2.5.2, Eq. 4)silhouette_width() — silhouette width on the
configuration’s own distance matrix (Section 2.5.1, Eq. 3)logrank_test() — multi-group log-rank chi-squared
statisticmc_replicate() — Monte Carlo replication of the
stability comparison (Section 2.6, Eq. 6)chaining_diagnostic() — Delta_CA = ARI - J_min (Section
2.5.4, Eq. 5), using mclust::adjustedRandIndex()select_k() — silhouette + gap statistic (one-SE rule) +
bootstrap stability curve + 5% minimum cluster size (Section 2.5.5)benchmark_methods() — k-means / Gaussian mixture /
Ward-Euclidean comparison (Section 5, Table 6)plot_covariate_heatmap() — reproduces manuscript Figure
4 (standardised covariate profile heatmap by cluster) for any covariate
matrixplot_km_by_cluster() — reproduces manuscript Figure 3
(Kaplan-Meier curves by cluster, one panel per endpoint, with
descriptive log-rank annotation)plot_stability_heatmap() — new visualisation not in the
manuscript: colours every valid distance x linkage combination by its
bootstrap J_min, making the “check stability, don’t assume a default”
argument visible at a glanceplot_dendrogram() — the hierarchical merge tree for a
given configuration, with the K-cluster cut outlinedplot_silhouette() — the standard per-observation
silhouette diagnostic plot (Rousseeuw 1987), showing which individual
patients are well- or poorly-clustered, not just the cluster
averagesilhouette_values() — per-observation silhouette values
(silhouette_width() now wraps this)generate_report() — knits a single self-contained HTML
report (stability result, stability heatmap, chaining diagnostic,
silhouette plot, dendrogram, and optionally a covariate heatmap and
Kaplan-Meier curves) for one analysis runembed_survival() no longer returns NaN
when a column has zero variance (e.g. the event indicator of an endpoint
with no censoring); such columns are centred to zero and a warning names
them.embed_survival() drops a leading T_ from
time column names, so colon_survival gives
logT_recur / E_recur instead of
logT_T_recur / E_T_recur.sim_competing_risks(): when PFS is clamped to the OS
time, the PFS event indicator now takes the OS status at that time
(death counts as a PFS event; OS censoring censors PFS).benchmark_methods(): time_s for the
proposed method now includes its bootstrap run (previously the timer
started after it, giving ~0 s).expect_equal(..., tolerance = 0.5) was a
50% relative tolerance.graphics and grDevices added to
Imports in DESCRIPTION.colon_survival — the manuscript’s real-data example
(929 patients, time to recurrence and time to death), reshaped wide from
colon_full.csvbenchmark_methods()’s Gaussian mixture step failed with
“could not find function mclustBIC” — mclust::Mclust()
resolves some of its internal helper functions by name lookup rather
than normal namespace scoping, so it requires mclust to be
fully attached, not just imported selectively. Fixed by moving
mclust from Imports to Depends in
DESCRIPTION.cluster_and_assign() only supports
'cosine'/'euclidean'. Table 2’s Manhattan and
single-linkage rows are stated in the manuscript’s own footnote to be
“interpolated by their relative ordering,” not computed.
cluster_assign() in this package does implement Manhattan
distance.cluster_configs() returns 21 configurations (7 valid
distance-linkage pairs x K in 3:5), not the manuscript’s stated 27 (9 x
3) — the “9 valid combinations” figure does not follow arithmetically
from the stated Ward.D2-restricted-to-Euclidean rule (3x3 - 2 invalid
Ward pairs = 7, not 9).