Cluster validation statistics
Computes a number of distance based statistics, which can be used for cluster validation, comparison between clusterings and decision about the number of clusters: cluster sizes, cluster diameters, average distances within and between clusters, cluster separation, biggest within cluster gap, average silhouette widths, the Calinski and Harabasz index, a Pearson version of Hubert's gamma coefficient, the Dunn index and two indexes to assess the similarity of two clusterings, namely the corrected Rand index and Meila's VI.
cluster.stats(d = NULL, clustering, alt.clustering = NULL, noisecluster=FALSE, silhouette = TRUE, G2 = FALSE, G3 = FALSE, wgap=TRUE, sepindex=TRUE, sepprob=0.1, sepwithnoise=TRUE, compareonly = FALSE, aggregateonly = FALSE)
d |
a distance object (as generated by |
clustering |
an integer vector of length of the number of cases, which indicates a clustering. The clusters have to be numbered from 1 to the number of clusters. |
alt.clustering |
an integer vector such as for
|
noisecluster |
logical. If |
silhouette |
logical. If |
G2 |
logical. If |
G3 |
logical. If |
wgap |
logical. If |
sepindex |
logical. If |
sepprob |
numerical between 0 and 1, see |
sepwithnoise |
logical. If |
compareonly |
logical. If |
aggregateonly |
logical. If |
cluster.stats
returns a list containing the components
n, cluster.number, cluster.size, min.cluster.size, noisen,
diameter,
average.distance, median.distance, separation, average.toother,
separation.matrix, average.between, average.within,
n.between, n.within, within.cluster.ss, clus.avg.silwidths, avg.silwidth,
g2, g3, pearsongamma, dunn, entropy, wb.ratio, ch, cwidegap,
widestgap, sindex,
corrected.rand, vi
except if compareonly=TRUE
, in which case
only the last two components are computed.
n |
number of cases. |
cluster.number |
number of clusters. |
cluster.size |
vector of cluster sizes (number of points). |
min.cluster.size |
size of smallest cluster. |
noisen |
number of noise points, see argument |
diameter |
vector of cluster diameters (maximum within cluster distances). |
average.distance |
vector of clusterwise within cluster average distances. |
median.distance |
vector of clusterwise within cluster distance medians. |
separation |
vector of clusterwise minimum distances of a point in the cluster to a point of another cluster. |
average.toother |
vector of clusterwise average distances of a point in the cluster to the points of other clusters. |
separation.matrix |
matrix of separation values between all pairs of clusters. |
ave.between.matrix |
matrix of mean dissimilarities between points of every pair of clusters. |
average.between |
average distance between clusters. |
average.within |
average distance within clusters (reweighted so that every observation, rather than every distance, has the same weight). |
n.between |
number of distances between clusters. |
n.within |
number of distances within clusters. |
max.diameter |
maximum cluster diameter. |
min.separation |
minimum cluster separation. |
within.cluster.ss |
a generalisation of the within clusters sum
of squares (k-means objective function), which is obtained if
|
clus.avg.silwidths |
vector of cluster average silhouette
widths. See
|
avg.silwidth |
average silhouette
width. See
|
g2 |
Goodman and Kruskal's Gamma coefficient. See Milligan and Cooper (1985), Gordon (1999, p. 62). |
g3 |
G3 coefficient. See Gordon (1999, p. 62). |
pearsongamma |
correlation between distances and a 0-1-vector where 0 means same cluster, 1 means different clusters. "Normalized gamma" in Halkidi et al. (2001). |
dunn |
minimum separation / maximum diameter. Dunn index, see Halkidi et al. (2002). |
dunn2 |
minimum average dissimilarity between two cluster / maximum average within cluster dissimilarity, another version of the family of Dunn indexes. |
entropy |
entropy of the distribution of cluster memberships, see Meila(2007). |
wb.ratio |
|
ch |
Calinski and Harabasz index (Calinski and Harabasz 1974, optimal in Milligan and Cooper 1985; generalised for dissimilarites in Hennig and Liao 2013). |
cwidegap |
vector of widest within-cluster gaps. |
widestgap |
widest within-cluster gap. |
sindex |
separation index, see argument |
corrected.rand |
corrected Rand index (if |
vi |
variation of information (VI) index (if |
Because cluster.stats
processes a full dissimilarity matrix, it
isn't suitable for large data sets. You may consider
distcritmulti
in that case.
Calinski, T., and Harabasz, J. (1974) A Dendrite Method for Cluster Analysis, Communications in Statistics, 3, 1-27.
Gordon, A. D. (1999) Classification, 2nd ed. Chapman and Hall.
Halkidi, M., Batistakis, Y., Vazirgiannis, M. (2001) On Clustering Validation Techniques, Journal of Intelligent Information Systems, 17, 107-145.
Hennig, C. and Liao, T. (2013) How to find an appropriate clustering for mixed-type variables with application to socio-economic stratification, Journal of the Royal Statistical Society, Series C Applied Statistics, 62, 309-369.
Hennig, C. (2013) How many bee species? A case study in determining the number of clusters. In: Spiliopoulou, L. Schmidt-Thieme, R. Janning (eds.): "Data Analysis, Machine Learning and Knowledge Discovery", Springer, Berlin, 41-49.
Kaufman, L. and Rousseeuw, P.J. (1990). "Finding Groups in Data: An Introduction to Cluster Analysis". Wiley, New York.
Meila, M. (2007) Comparing clusterings?an information based distance, Journal of Multivariate Analysis, 98, 873-895.
Milligan, G. W. and Cooper, M. C. (1985) An examination of procedures for determining the number of clusters. Psychometrika, 50, 159-179.
cqcluster.stats
is a more sophisticated version of
cluster.stats
with more options.
silhouette
, dist
, calinhara
,
distcritmulti
.
clusterboot
computes clusterwise stability statistics by
resampling.
set.seed(20000) options(digits=3) face <- rFace(200,dMoNo=2,dNoEy=0,p=2) dface <- dist(face) complete3 <- cutree(hclust(dface),3) cluster.stats(dface,complete3, alt.clustering=as.integer(attr(face,"grouping")))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.