Description Usage Arguments Value Author(s) Examples
View source: R/general-functions.R
Provides the calculation of within-cluster inertia, equivalent to
Inertia(k) = ∑_{i \in C_k} (y_{ik} - μ_k)^2
where μ_k is the mean of cluster k and C_k corresponds to the set of indices of genes attributed to cluster k.
1 |
profiles |
Matrix, data.frame, or DataFrame containing the (transformed) profiles used for the clustering |
clusters |
Vector of cluster labels corresponding to the observations in |
Within cluster inertia
Andrea Rau, Antoine Godichon-Baggioni
1 2 3 4 5 6 7 8 9 10 | ## Simulate toy data, n = 300 observations
set.seed(12345)
countmat <- matrix(runif(300*4, min=0, max=500), nrow=300, ncol=4)
countmat <- countmat[which(rowSums(countmat) > 0),]
conds <- rep(c("A","B","C","D"), each=2)
## Run the K-means algorithm for logclr profiles for K = 2,..., 20
run_kmeans <- coseq(object=countmat, K=2:20, transformation="logclr",
model="kmeans")
clusterInertia(profiles=tcounts(run_kmeans), clusters=clusters(run_kmeans))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.