Ward’s Hierarchical Agglomerative Clustering Method: Which Algorithms Implement Ward’s Criterion?
Fionn MurtaghPierre Legendre
Resolves widespread discrepancies in how Ward's hierarchical clustering method is formulated and implemented across standard software packages, establishing clear mathematical guidelines for developers and data analysts.
Two common but subtly different algorithms in statistical software both claim to implement Ward’s hierarchical clustering, which groups observations to minimize the increase in within-cluster sum of squares at each step. The resulting confusion matters because Ward’s method is widely used alongside principal component analysis and K-means partitioning, and incorrect implementations can produce non-optimal or non-comparable cluster trees.
The paper set out to determine which published algorithms and software packages actually optimize Ward’s criterion, to explain why apparently similar code yields different results, and to show users how to obtain correct output.
The authors reviewed the Lance-Williams recurrence formulas that drive most agglomerative clustering routines, derived the precise input and scaling requirements for each variant, and tested the implementations on reproducible simulated data. They compared the R functions hclust and agnes, a custom extension of hclust that offers both variants, and six commercial packages, checking both dendrogram topology and the numerical values of the clustering criterion.
The analysis shows that only one variant—commonly called Ward2—minimizes the Ward criterion when Euclidean distances are supplied directly. The other variant, Ward1, requires squared Euclidean distances as input and produces squared criterion values; taking square roots of its dendrogram heights then recovers identical results. When both algorithms are applied to the same unsquared distance matrix, they generate different trees and different criterion values. Experiments confirmed that agnes (method “ward”) and the “ward.D2” option in an updated hclust implement Ward2 correctly, while the original hclust (method “ward”) implements Ward1. Among commercial packages examined in 2012, Statistica, Systat, and SPSS used Ward1, whereas Matlab, SAS, and JMP used Ward2.
These differences matter for any analysis that relies on the numerical values of the clustering criterion or on consistency with K-means or ordination methods. Using the wrong input or failing to scale output heights can produce trees that do not minimize within-cluster variance and that cannot be compared directly with results from other software.
Users should verify which algorithm their package applies and adjust inputs or post-process outputs accordingly: supply squared distances to Ward1 implementations or use a confirmed Ward2 routine. Software maintainers are advised to document the required steps clearly and, where feasible, to offer both options with appropriate warnings. Further verification on larger or domain-specific data sets would increase practical confidence, but the mathematical identity of the correctly configured algorithms is established.
No sufficiently relevant recommendations were found.
No sufficiently relevant recommendations were found.
