cluster() fits a clustering with a configuration from one of the setup_*() functions listed by available_clustering(). It returns a HardClustering, with one cluster label per case, or a SoftClustering, which adds a matrix of memberships. This chapter clusters the patients of the diabetes data by their nine numeric baseline measurements, chooses the number of clusters, compares methods, and describes the clusters by the outcome that the clustering did not use.
available_clustering()
CMeans: Fuzzy c-means clustering
DBSCAN: DBSCAN density-based clustering
GMM: Gaussian mixture model clustering
HOPACH: Hierarchical Ordered Partitioning and Collapsing Hybrid
HardCL: Hard competitive learning
KMeans: K-means clustering
NeuralGas: Neural Gas clustering
PAM: Partitioning Around Medoids
PAMK: Partitioning Around Medoids with estimation of the number of clusters
SpectralLaplace: Spectral clustering with an exponential kernel, which decays more slowly than the Gaussian and so keeps more weight on distant pairs
SpectralLocal: Spectral clustering with a Gaussian kernel whose width is set per case from the distance to its seventh nearest neighbor, which lets one clustering hold groups of differing density
SpectralRBF: Spectral clustering with a Gaussian kernel of one shared width
49.1 Data
The nine numeric features are standardized, so that each contributes equally to the Euclidean distance (Section 48.1):
The average silhouette width is highest at \(k\) = 2, at 0.25. Kaufman and Rousseeuw (1990) describe an average silhouette width of 0.25 or less as indicating no substantial structure, and 0.26 to 0.50 as weak structure that could be artificial. The values here are at or below that boundary for every \(k\): the patients form a continuum rather than separated groups, as the embeddings of Section 47.3 suggested.
setup_PAMK() fits partitioning around medoids for a range of \(k\) and selects \(k\) by a criterion, here the average silhouette width:
The soft clustering gives each patient a posterior probability for each component. The median of each patient’s largest posterior probability is 1.00, and 1.8% of patients have no component with a posterior probability of 0.8 or more.
BIC and the silhouette select different numbers of clusters. BIC rewards a better description of the density, which several overlapping normal components can provide for a single continuous cloud of cases; the silhouette rewards separated groups.
49.4 Agreement between methods
The adjusted Rand index compares two partitions of the same cases (Section 48.7):
Methods with the same number of clusters agree partly. In data without separated groups, each method divides the continuum according to its own objective, and the partitions differ accordingly.
49.5 Density-based clustering
setup_DBSCAN() requires the neighborhood radius eps. The distance of each case to its 5th nearest neighbor shows the scale of local distances:
With eps = 0.5, smaller than almost every nearest-neighbor distance in nine standardized dimensions, every patient is noise. With eps = 1.5, DBSCAN finds a single cluster of 243 patients and labels the rest noise; with eps = 2.5, a single cluster containing all but 4. At none of the three radii does it find more than one dense region.
49.6 Describing clusters by an external variable
The k-means clusters with \(k = 3\) can be described by variables not used to form them, such as disease progression:
The clusters differ in mean progression, since they differ in BMI and s5, which predict it. In the space of the first two principal components, the three clusters are adjacent regions of one cloud. They are a description of how these patients’ measurements vary, under the chosen features and distance, not evidence of three distinct types of patient (Section 48.7).
Kaufman, Leonard, and Peter J. Rousseeuw. 1990. Finding Groups in Data: An Introduction to Cluster Analysis. In Wiley Series in Probability and Statistics. Wiley. https://doi.org/10.1002/9780470316801.