Multivariate & ML · Clustering

Hierarchical Clustering

Build an agglomerative hierarchy of observations and cut it into a chosen number of clusters, with a dendrogram, cluster centroids, silhouette score, and cophenetic correlation.

In the menus Multivariate & ML › Clustering › Hierarchical Clustering

Also searched as hierarchical clustering dendrogram agglomerative clustering hclust ward clustering

When to use it

Discover nested groupings in numeric data without choosing k up front: inspect the dendrogram, then cut it where the structure is clearest.

When not to: Very large datasets (the full distance matrix costs O(n^2) memory, about 6.4 GB for the distance matrix alone at 40,000 rows, so use k-means instead, which scales to the whole table), when you already know exactly how many clusters you want and do not need the tree structure (k-means is simpler and faster), or when clusters are expected to be highly elongated/chain-like with single linkage specifically producing an unhelpfully stringy tree.

Step by step

  1. Open it from the menu

    Click Multivariate & ML in the menu bar; under Clustering choose Hierarchical Clustering.

  2. Fill in the form

    Choose the columns: Columns to group rows by. The form lists only columns whose type fits each field.

  3. Check the options

    The options start at their defaults: Number of clusters, Linkage method, Distance metric, Standardize. Change one only when your question needs it.

  4. Run the analysis

    Press Run analysis. The Result Card opens on its Results tab.

What to choose in the form

Fields of the Hierarchical Clustering form
Columns to group rows by Variables requiredOne numeric column. One or more continuous variables to cluster on.
Number of clustersHow many flat clusters to cut the tree into. Default: 3.
Linkage methodHow distance between clusters is defined when merging (Ward requires Euclidean distance). Default: ward.
Distance metricPairwise distance metric between observations. Default: euclidean.
StandardizeStandardize each variable to mean 0, SD 1 before clustering so no variable dominates by scale. Default: on.

How to read the card

The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.

What it assumes

Independence of observations

If it does not hold: Hierarchical clustering treats every row as an independent point; clustering rows that are actually repeated measurements of the same unit, or otherwise dependent, can create spurious groups that just reflect the dependency structure rather than genuine subpopulations.

How to check: Not checked by KernelStats.

A worked example

Agglomerative clustering (Ward linkage, Euclidean distance, standardized) on four penguin body measurements across 342 birds, cut into 3 clusters.

Result: Cophenetic correlation = 0.83, silhouette = 0.45; cluster sizes are 123, 57 and 162, so one cluster matches the 123 Gentoo exactly while the other two split the 151 Adelie and 68 Chinstrap imperfectly.

The dendrogram represents the original distances reasonably faithfully, and the 3-cluster cut recovers one species cleanly, but the moderate silhouette and the Adelie/Chinstrap mixing show the body measurements alone do not separate all three species; agreement with a known grouping on one cluster is not proof that three is the right number of clusters.

From the Statistics Library.

The code tabs

Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.

Understand the statistics

Ask Oobi

Type one of these into Ask Oobi beside your data:

  • How do penguins group hierarchically by their body measurements, and where should the tree be cut?
  • Explain the hierarchical (agglomerative) clustering in plain words.
  • What does outliers mean?

Last reviewed November 16, 2026.

Report an unclear step