| characterize_clusters | R Documentation |
For a clustering, summarise how each external variable differs across the
clusters. Continuous variables get n, mean, SD, median, IQR and range
per cluster, an overall Kruskal-Wallis test, a rank \eta^2 effect
size, and gradient detection (are the cluster means monotonically
ordered?). Categorical variables get per-cluster counts and column
percentages, a chi-squared / Fisher test and Cramer's V. The emphasis is on
effect sizes and descriptive summaries rather than p-values alone.
characterize_clusters(labels, metadata, continuous = NULL, categorical = NULL)
labels |
Cluster label of each object (vector; |
metadata |
A data frame of external variables, one row per object, in the
same order as |
continuous, categorical |
Optional character vectors naming the columns to
treat as continuous / categorical. If |
A list with continuous (per-cluster summary, long format),
continuous_tests (one row per variable: KW_p, eta2,
gradient – the clusters ordered by mean – and a monotone-trend
trend_rho/trend_p), categorical (counts and column
percentages) and categorical_tests (p, cramers_v).
plot_cluster_profile, cluster_biology_panel
data(mosaic_toy)
fit <- M_ABC(mosaic_toy$List, numsim = 40, NC = 3)
cl <- mosaic_labels(fit, 3)
meta <- data.frame(score = rnorm(length(cl)), grp = sample(c("A", "B"), length(cl), TRUE))
ch <- characterize_clusters(cl, meta)
ch$continuous_tests
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.