K-Means Cluster Analysis in PAST: A Practical Guide with Example Data

Introduction

Cluster analysis is an important multivariate statistical technique used to classify observations into groups according to their similarity. Unlike many conventional statistical methods, cluster analysis does not require predefined group labels. Instead, the method searches for naturally occurring patterns within a dataset and assigns observations to groups called clusters.

K-means clustering is one of the most widely used partitioning methods. It is particularly useful when researchers want to explore whether observations can be separated into a specified number of relatively similar groups. In biological and ecological research, it can be applied to species abundance, environmental measurements, morphological characteristics, sampling sites, community composition and other multivariable datasets.

The PAST (Paleontological Statistics) software provides an accessible environment for performing K-means clustering and examining cluster membership and silhouette values. In this example, 15 butterfly species were evaluated using observations from 10 sites. The analysis was performed with two clusters (k = 2).

The objective was to determine whether the butterfly species could be separated into two groups based on their patterns across the ten sampling sites.

What is Cluster Analysis?

Cluster analysis is an exploratory multivariate technique that groups observations according to their similarity or dissimilarity.

For example, suppose several butterfly species have abundance values recorded at different sampling sites. Species showing similar distribution patterns across the sites may be placed in the same cluster.

The important point is that cluster analysis is generally unsupervised. The researcher does not initially tell the method which species belong together. Instead, the algorithm identifies groupings from the supplied numerical variables.

Basic concept

The process can be represented as:

Raw multivariate data
↓
Calculate similarity/distance
↓
Select number of clusters
↓
Assign observations to clusters
↓
Calculate cluster centres
↓
Evaluate cluster separation
↓
Interpret biological/ecological patterns

What is K-Means Clustering?

K-means clustering is a partitioning algorithm that divides observations into a predefined number of clusters, represented by K.

In this analysis:

K = 2

Therefore, the 15 butterfly species were divided into two clusters.

The algorithm attempts to place observations into clusters so that observations within the same cluster are relatively similar, while observations belonging to different clusters are relatively different.

Conceptually, K-means minimizes the within-cluster sum of squares (WGSS):WGSS=∑k=1K∑i∈Ckd(xi,μk)2WGSS = \sum_{k=1}^{K}\sum_{i\in C_k}d(x_i,\mu_k)^2

where:

  • KK = number of clusters
  • CkC_k = observations belonging to cluster kk
  • xix_i = individual observation
  • μk\mu_k = centroid of cluster kk
  • dd = distance between an observation and its cluster centroid

The algorithm repeatedly updates the cluster assignments and cluster centres until the grouping stabilizes.

Dataset Used for the Analysis

The uploaded dataset contains 15 butterfly species and measurements from 10 sites.

Table 1. Structure of the dataset

VariableDescription
Butterfly SpeciesObservation/species identifier
Site 1Observation at Site 1
Site 2Observation at Site 2
Site 3Observation at Site 3
Site 4Observation at Site 4
Site 5Observation at Site 5
Site 6Observation at Site 6
Site 7Observation at Site 7
Site 8Observation at Site 8
Site 9Observation at Site 9
Site 10Observation at Site 10
Number of species15
Number of numerical variables10

The species names were represented as Species A through Species O.

Download Dataset

9 KB

K-Means Analysis in PAST

The K-means analysis was performed using two clusters.

The resulting PAST output showed:

PAST outputResult
Number of clusters2
WGSS2172.9
F0.32397
Var %24.47
Average silhouette0.027853

The WGSS (within-group sum of squares) represents the total within-cluster variation associated with the solution. Lower within-cluster variation generally corresponds to more compact clusters, although WGSS should not be interpreted independently of the number of clusters.

The average silhouette value provides information about how well observations fit their assigned clusters. Values close to 1 indicate strong separation, values around zero indicate substantial overlap or observations near cluster boundaries, and negative values indicate observations that may be closer to another cluster than their assigned cluster.

K-Means Cluster Membership

The PAST analysis divided the 15 butterfly species into two groups.

Table 2. K-means cluster membership of butterfly species

ClusterButterfly speciesNumber of species
Cluster 1Species A, C, E, F, I, L, N, O8
Cluster 2Species B, D, G, H, J, K, M7

Thus, Cluster 1 contained eight species, whereas Cluster 2 contained seven species.

Cluster 1

Species A, C, E, F, I, L, N and O.

Cluster 2

Species B, D, G, H, J, K and M.

The cluster numbers themselves are labels rather than biological categories. Therefore, Cluster 1 should not automatically be interpreted as a “high” or “low” group without examining the underlying variables.

Silhouette Analysis

The silhouette table provides an observation-level assessment of the clustering solution.

Table 3. Silhouette values for the two-cluster solution

SpeciesClusterSilhouette
Species F10.117710
Species N10.110850
Species I10.096642
Species C10.086835
Species O10.038808
Species E10.038424
Species L1-0.033244
Species A1-0.174240
Species H20.208510
Species M20.132470
Species D20.109140
Species B20.048865
Species J2-0.060232
Species K2-0.090194
Species G2-0.212550

The overall mean silhouette calculated from the displayed individual values is approximately 0.02785, matching the PAST output.

Interpretation of Silhouette Results

The silhouette results provide an important qualification to the cluster membership.

Several species have positive silhouette values, indicating some degree of association with their assigned cluster. For example, Species H has the highest silhouette value in the displayed output at 0.208510, followed by Species M (0.132470), Species F (0.117710), Species N (0.110850) and Species D (0.109140).

However, the overall average silhouette is only 0.027853. This is close to zero, indicating that the two clusters have considerable overlap in multivariate space.

Several species also have negative silhouette values:

  • Species A = -0.174240
  • Species G = -0.212550
  • Species K = -0.090194
  • Species J = -0.060232
  • Species L = -0.033244

A negative silhouette value does not mean that the species is biologically incorrect or that the analysis has failed. Rather, it indicates that the observation is relatively close to the alternative cluster according to the distance structure used in the analysis.

Therefore, the K-means result should be regarded as an exploratory grouping, rather than definitive evidence that the butterfly species form two strongly separated groups.

Cluster Characteristics

The mean values for each site can also help describe the two clusters.

Table 4. Mean site values by cluster

SiteCluster 1 MeanCluster 2 Mean
Site 18.8758.857
Site 210.2507.571
Site 37.37513.000
Site 411.2508.571
Site 510.00012.000
Site 612.0008.000
Site 712.3758.429
Site 86.25014.286
Site 914.0008.286
Site 108.87512.000

The cluster means show that the two groups have different patterns across several sites.

Cluster 1 has higher mean values at Sites 2, 4, 6, 7 and 9, while Cluster 2 has higher mean values at Sites 3, 5, 8 and 10. Site 1 has almost identical means between the two clusters.

This suggests that the clustering is driven by different distribution patterns across sampling sites, rather than by a simple overall difference in abundance.

K-Means Cluster Pattern

The supplied horizontal bar plot illustrates the relative positioning of the butterfly species associated with the two-cluster solution.

Figure 1. K-means clustering pattern of the 15 butterfly species based on observations across 10 sites.

The figure can be interpreted together with the cluster membership table. Species positioned relatively close to one another according to the underlying multivariate measurements show greater similarity, whereas species separated from one another represent greater dissimilarity.

The visual pattern should not be interpreted as a direct measure of statistical significance. Rather, it provides a graphical representation of the multivariate relationships identified by the analysis.

Biological Interpretation

The K-means analysis indicates that the butterfly species can be partitioned into two groups based on their recorded patterns across the ten sites.

Cluster 1 consists of Species A, C, E, F, I, L, N and O. This group shows relatively higher average values at several sites, particularly Sites 6, 7 and 9.

Cluster 2 consists of Species B, D, G, H, J, K and M. This group shows comparatively higher averages at Sites 3, 5, 8 and 10.

These differences may indicate that the two groups have different spatial distribution patterns in the study dataset. However, the cluster analysis alone cannot establish the ecological mechanism responsible for these patterns. Environmental variables, habitat characteristics, season, resource availability and other ecological factors would need to be examined separately before making biological explanations.

The low average silhouette value is particularly important. It indicates that the species are not separated into two highly distinct groups based on the variables included in the analysis.

Important Point About the Number of Clusters

K-means requires the researcher to specify the number of clusters in advance. Here, K = 2 was selected.

However, choosing two clusters does not automatically mean that two clusters provide the only or optimal representation of the dataset.

A researcher can compare solutions using:

  • K = 2
  • K = 3
  • K = 4
  • K = 5

and examine measures such as:

  • Within-group sum of squares
  • Silhouette values
  • Cluster stability
  • Biological interpretability
  • Separation between clusters

For this dataset, the low average silhouette for K = 2 suggests that examining alternative cluster numbers could be useful before drawing strong conclusions.

Limitations of K-Means Clustering

K-means also has important limitations.

First, the number of clusters must be specified before the analysis. Second, the method can be affected by the scale of variables. If variables are measured on very different scales, standardization may be necessary.

The method can also be sensitive to the starting positions of cluster centres and to unusual observations. Furthermore, K-means works best when the underlying groups are reasonably compact and distinguishable using the selected distance measure.

Therefore, cluster membership should not automatically be interpreted as a biological classification. It is a statistical grouping based on the variables supplied to the analysis.

Results Summary

Table 5. Summary of K-means clustering results

ParameterResult
Observations15 species
Numerical variables10 sites
Number of clusters2
Cluster 18 species
Cluster 27 species
WGSS2172.9
F0.32397
Variance (%)24.47
Average silhouette0.027853

Main finding

The K-means procedure divided the 15 butterfly species into two groups:

Cluster 1: A, C, E, F, I, L, N and O
Cluster 2: B, D, G, H, J, K and M

The average silhouette value of 0.027853 indicates that the two groups show substantial overlap and that the separation between clusters is weak in this particular two-cluster solution.

Conclusion

K-means cluster analysis provides a useful exploratory approach for identifying groups of similar observations in multivariate biological datasets. In the present analysis, 15 butterfly species characterized by observations from 10 sites were classified into two clusters using PAST.

Cluster 1 contained eight species—A, C, E, F, I, L, N and O—whereas Cluster 2 contained seven species—B, D, G, H, J, K and M. The cluster means demonstrated different patterns across the ten sampling sites, suggesting that the groups differ in their distribution profiles.

However, the average silhouette value of 0.027853, together with several negative individual silhouette values, indicates substantial overlap between the two groups. Consequently, the current K = 2 solution should be interpreted as an exploratory pattern rather than a strongly separated classification.

For a more robust analysis, researchers may compare different numbers of clusters and examine silhouette values and biological interpretability before selecting a final clustering solution. Combining K-means results with ecological information and appropriate visualization can provide a more complete understanding of species distribution patterns.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top