CH.IDX {UniversalCVI} | R Documentation |
Calinski–Harabasz (CH) index
Description
Computes the CH (T. Calinski and J. Harabasz, 1974) index for a result either kmeans or hierarchical clustering from user specified kmin
to kmax
.
Usage
CH.IDX(x, kmax, kmin = 2, method = "kmeans", nstart = 100)
Arguments
x |
a numeric data frame or matrix where each column is a variable to be used for cluster analysis and each row is a data point. |
kmax |
a maximum number of clusters to be considered. |
kmin |
a minimum number of clusters to be considered. The default is |
method |
a character string indicating which clustering method to be used ( |
nstart |
a maximum number of initial random sets for kmeans for |
Details
The CH index is defined as
CH(k) = \frac{n-k}{k-1}\frac{\sum_{i=1}^k|C|_id(v_i,\bar{x})}{\sum_{i=1}^k\sum_{x_j\in C_i}d(x_j,v_i)}
The largest value of CH(k)
indicates a valid optimal partition.
Value
CH |
the CH index for |
Author(s)
Nathakhun Wiroonsri and Onthada Preedasawakul
References
T. Calinski, J. Harabasz, "A dendrite method for cluster analysis," Communications in Statistics, 3, 1-27 (1974).
See Also
Hvalid, Wvalid, DI.IDX, FzzyCVIs, R1_data
Examples
library(UniversalCVI)
# The data is from Wiroonsri (2024).
x = R1_data[,1:2]
# ---- Kmeans ----
# Compute the CH index
K.CH = CH.IDX(scale(x), kmax = 15, kmin = 2, method = "kmeans", nstart = 100)
print(K.CH)
# The optimal number of cluster
K.CH[which.max(K.CH$CH),]
# ---- Hierarchical ----
# Average linkage
# Compute the CH index
H.CH = CH.IDX(scale(x), kmax = 15, kmin = 2, method = "hclust_average")
print(H.CH)
# The optimal number of cluster
H.CH[which.max(H.CH$CH),]