View source: R/addclustermethods.R
calinhara | R Documentation |
Calinski-Harabasz index for estimating the number of clusters,
based on an observations/variables-matrix here. A distance based
version is available through cluster.stats
.
calinhara(x,clustering,cn=max(clustering))
x |
data matrix or data frame. |
clustering |
vector of integers. Clustering. |
cn |
integer. Number of clusters. |
Calinski-Harabasz statistic, which is
(n-cn)*sum(diag(B))/((cn-1)*sum(diag(W)))
. B being the
between-cluster means,
and W being the within-clusters covariance matrix.
Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en
Calinski, T., and Harabasz, J. (1974) A Dendrite Method for Cluster Analysis, Communications in Statistics, 3, 1-27.
cluster.stats
set.seed(98765)
iriss <- iris[sample(150,20),-5]
km <- kmeans(iriss,3)
round(calinhara(iriss,km$cluster),digits=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.