| unsurv-package | R Documentation |
The unsurv package provides tools for unsupervised clustering of individualized survival curves using medoid-based clustering (PAM).
It is designed for settings where each individual is represented by a survival probability curve evaluated on a common time grid, such as predictions from:
Kaplan–Meier estimates,
Cox models,
parametric survival models,
deep learning survival models,
or other individualized survival predictors.
Core features include:
PAM clustering using weighted L1 or L2 distances,
automatic cluster selection via silhouette width,
optional monotonicity enforcement,
optional median smoothing,
prediction of cluster membership for new curves,
stability assessment via resampling and Adjusted Rand Index,
base R and ggplot2 visualization methods.
Main functions:
unsurv — fit clustering model
predict.unsurv — predict cluster membership
plot.unsurv — plot medoid curves
summary.unsurv — summarize clustering
unsurv_stability — assess stability
Imad EL BADISY
Kaufman, L., & Rousseeuw, P. J. (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Wiley.
Useful links:
if (requireNamespace("cluster", quietly = TRUE)) {
set.seed(1)
n <- 10
times <- seq(0, 5, length.out = 40)
rates <- sample(c(0.2, 0.6), n, TRUE)
S <- sapply(times, function(t) exp(-rates * t))
fit <- unsurv(S, times, K = 2)
plot(fit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.