| Type: | Package |
| Title: | Cluster Validity Indices |
| Version: | 1.0 |
| Date: | 2026-06-05 |
| Author: | Michail Tsagris [aut, cre], Nikolaos Kontemeniotis [aut] |
| Maintainer: | Michail Tsagris <mtsagris@uoc.gr> |
| Depends: | R (≥ 4.0) |
| Imports: | factoextra, graphics, lowmemtkmeans, Rfast, Rfast2, stats |
| Description: | Numerous indices to choose the optimal number of clusters when performing k-means. Relevant papers include: Tsagris M. and Kontemeniotis N. (2025). Lobachevskii Journal of Mathematics <doi:10.1134/S1995080225613700>. Garcia-Escudero Luis A., Gordaliza Alfonso, Matran Carlos, Mayo-Iscar Agustin. (2008) <doi:10.1214/07-AOS515>. |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| NeedsCompilation: | no |
| Packaged: | 2026-06-05 09:13:20 UTC; mtsag |
| Repository: | CRAN |
| Date/Publication: | 2026-06-10 07:40:08 UTC |
Cluster Validity Indices
Description
Numerous indices to choose the optimal number of clusters when performing k-means.
Details
| Package: | clusterindices |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2026-06-05 |
| License: | GPL-2 |
Maintainers
Michail Tsagris <mtsagris@uoc.gr>
Author(s)
Michail Tsagris mtsagris@uoc.gr and Nikolaos Kontemeniotis kontemeniotisn@gmail.com.
References
Tsagris M. and Kontemeniotis N. (2025). Simplicial clustering using the \alpha–transformation.
Lobachevskii Journal of Mathematics, 46: 6471–6482.
https://arxiv.org/pdf/2509.05945.
Garcia-Escudero Luis A., Gordaliza Alfonso, Matran Carlos, Mayo-Iscar Agustin. (2008). A general trimming approach to robust cluster analysis. Annals of Statistics 36(3): 1324–1345.
The K–means algorithm with cluster indices computed
Description
The K–means algorithm with cluster indices computed.
Usage
cikmeans(y, ncl = 10, trim = 0, max.iters = 50, nstart = 10, all = FALSE)
Arguments
y |
A matrix with numerical data. |
ncl |
The maximum number of clusters to try. The minimum number of clusters is 2. |
trim |
A number in [0, 1). If trim = 0, then the classical |
max.iters |
The maximum number of iterations allowed during the |
nstart |
How many random starts to perform? |
all |
If this is TRUE, then the clustering indices of each observation for each number of clusters will be returned. |
Details
The K–means algorithm is performed and a series of cluster validity indices are computed.
Value
A list inclusing:
min_crit |
A matrix with 9 columns and at least one row, where each column contains the value of a cluster validity index, whose minimal vlaue is preferred. Each row corresponds to a specific number of clusters, starting from 2 up to ncl. |
best_min |
The number of clusters selected based upon the minimal valued cluster validity indices. |
max_crit |
A matrix with 24 columns and at least one row, where each column contains the value of a cluster validity index, whose minimal vlaue is preferred. Each row corresponds to a specific number of clusters, starting from 2 up to ncl. |
best_max |
The number of clusters selected based upon the maximal valued cluster validity indices. |
cluster |
If the argument "all" is TRUE, then the clustering indices of each observation for each number of clusters will be returned in a matrix, where each column corresponds to the clustering of each number of clusters. |
Author(s)
Michail Tsagris and Nikolaos Kontemeniotis.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and Nikolaos Kontemeniotis kontemeniotisn@gmail.com.
References
Garcia-Escudero Luis A., Gordaliza Alfonso, Matran Carlos, Mayo-Iscar Agustin. (2008). A general trimming approach to robust cluster analysis. Annals of Statistics 36(3): 1324–1345.
See Also
clust.plot, index_min, index_max
Examples
y <- as.matrix(iris[, 1:4])
mod <- cikmeans(y, ncl = 5)
Visualization of the K–means algorithm results
Description
Visualization of the K–means algorithm results.
Usage
clust.plot(y, mod)
Arguments
y |
A matrix with the data. |
mod |
The output of the kmeans() function. |
Details
The function performs PCA and plots the data onto the first two dimensions, constructs the convex hull of the groups and plots them with different colours.
Value
A plot.
Author(s)
Michail Tsagris and Nikolaos Kontemeniotis.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr and Nikolaos Kontemeniotis kontemeniotisn@gmail.com.
References
Tsagris M. and Kontemeniotis N. (2025). Simplicial clustering using the \alpha–transformation.
Lobachevskii Journal of Mathematics, 46: 6471–6482.
https://arxiv.org/pdf/2509.05945.
Garcia-Escudero Luis A., Gordaliza Alfonso, Matran Carlos, Mayo-Iscar Agustin. (2008). A general trimming approach to robust cluster analysis. Annals of Statistics 36(3): 1324–1345.
See Also
Examples
y <- as.matrix(iris[, 1:4])
mod <- kmeans(y, 3)
clust.plot(y, mod)
Cluster indices (maximal valued) for the K–means algorithm
Description
Cluster indices (maximal valued) for the K–means algorithm.
Usage
index_max(y, mod)
Arguments
y |
A matrix with numerical data. |
mod |
An object with the result of the |
Details
A series of cluster validity indices (maximal valued) are computed.
Value
A vector with 24 cluster validity indices.
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
See Also
Examples
y <- as.matrix(iris[, 1:4])
mod <- kmeans(y, 3)
mod <- index_max(y, mod)
Cluster indices (minimial valued) for the K–means algorithm
Description
Cluster indices (minimal valued) for the K–means algorithm.
Usage
index_min(y, mod)
Arguments
y |
A matrix with numerical data. |
mod |
An object with the result of the |
Details
A series of cluster validity indices (minimal valued) are computed.
Value
A vector with 9 cluster validity indices.
Author(s)
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
See Also
Examples
y <- as.matrix(iris[, 1:4])
mod <- kmeans(y, 3)
mod <- index_min(y, mod)