Analysis Types

Cluster Analysis – Types, Methods and Examples

Table of Contents

Cluster analysis is an exploratory statistical and machine-learning approach that groups observations according to their similarity. Members of the same cluster should be relatively alike, while members of different clusters should be relatively dissimilar. The resulting groups are not predefined; they depend on the variables, similarity measure, algorithm and analytical purpose.

Cluster Analysis

Cluster analysis helps researchers identify patterns that may be difficult to see in a large multivariable dataset. It is used to segment customers, identify patient profiles, group schools or communities, classify ecological sites, organize documents, analyze gene-expression patterns and detect unusual observations.

This guide explains what cluster analysis is, how its major methods work, how to choose an algorithm, how to determine the number of clusters, how to validate the results and how to report the analysis transparently.

Key takeaways

  • Cluster analysis groups observations without using predefined outcome labels.
  • There is no universally best clustering algorithm because methods define similarity and clusters differently.
  • Scaling, variable selection, missing-data treatment and the distance measure can materially change the solution.
  • The number of clusters should be selected using several forms of evidence rather than one automatic statistic.
  • A useful cluster solution should be coherent, stable, interpretable and relevant to the research objective.
  • Clusters are exploratory constructions and should not automatically be treated as natural or permanent categories.

What Is Cluster Analysis?

Cluster analysis is a family of methods used to place observations into groups based on selected characteristics. Its objective is usually to achieve:

  • High similarity among observations within the same cluster
  • Lower similarity between observations assigned to different clusters
  • A manageable representation of patterns in multivariate data

The observations may be people, patients, organizations, locations, documents, products, images, genes or other units of analysis.

Suppose a researcher collects data about students’ weekly study hours, class attendance, assessment performance and use of online learning resources. Cluster analysis might identify groups such as highly engaged students, assessment-focused students and students with low overall engagement. These categories were not entered into the analysis beforehand; they were constructed from similarities in the selected variables.

Cluster Analysis as an Exploratory Method

Cluster analysis is usually exploratory. It can suggest patterns, generate hypotheses and create descriptive typologies, but it does not by itself establish:

  • Causation
  • Statistical significance of substantive differences
  • Permanence of the groups
  • A unique or objectively true classification
  • Predictive accuracy for future observations

A clustering algorithm will often return groups even when the data contain little meaningful cluster structure. Researchers must therefore evaluate whether the solution is stable, interpretable and useful.

Is Cluster Analysis Statistical or Machine Learning?

It is both.

In statistics, cluster analysis is treated as an exploratory multivariate technique. In machine learning, it is usually described as unsupervised learning because the algorithm receives no predefined target labels.

The two traditions use overlapping methods but may emphasize different goals. Statistical applications often focus on inference, interpretation and uncertainty, while machine-learning applications may emphasize computational performance, scalability and pattern discovery.

How Does Cluster Analysis Work?

Cluster analysis generally follows four ideas:

  1. Represent each observation with selected features.
  2. Define similarity or dissimilarity between observations.
  3. Apply an algorithm that constructs groups.
  4. Evaluate and interpret the resulting solution.

The apparent simplicity can be misleading. Each stage contains decisions that influence the answer.

1. Observations Are Represented by Features

A customer might be represented by:

  • Number of purchases
  • Average order value
  • Time since last purchase
  • Product categories purchased
  • Number of website sessions

A patient might be represented by symptoms, biomarkers, age, treatment history and functional scores.

The algorithm can only identify structure contained in the chosen features. Omitting an important variable or including an irrelevant one may change the clusters substantially.

2. Similarity or Distance Is Calculated

For numerical variables, similarity is often represented by distance. Observations with smaller distances are treated as more similar.

For categorical, binary, text or mixed data, other measures may be more appropriate. The selected measure determines what “similar” means in the analysis.

3. An Algorithm Creates the Groups

Different algorithms use different definitions of a cluster:

  • K-means looks for compact groups around centroids.
  • Hierarchical clustering builds nested groupings.
  • DBSCAN identifies dense connected regions.
  • Gaussian mixture models represent data as a mixture of probability distributions.
  • Fuzzy clustering allows partial membership in multiple groups.

Consequently, two algorithms can produce different results from the same dataset without either result being a computational error.

4. The Solution Is Evaluated

Researchers examine:

  • Cohesion within clusters
  • Separation between clusters
  • Stability under resampling or alternative specifications
  • Cluster sizes
  • Interpretability
  • Relevance to the research objective
  • Relationships with external variables

A high internal validation score is useful but does not prove that the clusters are scientifically meaningful.

Cluster Analysis Compared With Related Methods

MethodMain purposeWhat is grouped or predicted?Predefined outcome labels?
Cluster analysisDiscover groups of similar observationsUsually rows, cases or observationsNo
ClassificationAssign observations to known categoriesA predefined class labelYes
Discriminant analysisModel and predict membership in known groupsKnown group membershipYes
Factor analysisIdentify latent dimensions underlying correlated variablesVariables or indicatorsNo class labels
Principal component analysisCreate components that summarize varianceVariables transformed into componentsNo class labels
Latent class analysisEstimate probabilistic classes from categorical indicatorsObservationsNo observed class label, but a statistical mixture model is specified
Latent profile analysisEstimate probabilistic profiles from continuous indicatorsObservationsNo observed class label
Cluster samplingSelect naturally occurring groups for a sampleSampling unitsNot a grouping algorithm

Cluster Analysis Versus Factor Analysis

Cluster analysis usually groups observations, whereas factor analysis groups or summarizes relationships among variables.

A researcher might use factor analysis to reduce 30 questionnaire items to five factor scores and then use those scores as inputs for cluster analysis. However, this sequence should be theoretically justified because dimensionality reduction can remove information or alter the geometry of the data.

Cluster Analysis Versus Classification

Classification begins with known labels, such as “disease present” and “disease absent.” The model learns to predict those labels.

Cluster analysis begins without known labels. The algorithm proposes groups based on the selected representation of similarity.

Cluster labels created by an exploratory analysis can later be used in a supervised classification model, but that second model predicts the original clustering solution rather than independently proving that the clusters are real.

Cluster Analysis Versus Latent Class Analysis

Traditional cluster algorithms are usually distance- or density-based. Latent class and latent profile models are probabilistic. They specify a statistical model for how the observed data arise from unobserved classes.

Model-based approaches may provide:

  • Membership probabilities
  • Information criteria
  • Explicit distributional assumptions
  • Formal comparison of candidate models

They can be more suitable when overlapping groups and classification uncertainty are central to the research question.

Main Types of Cluster Analysis

Partitioning Clustering

Partitioning methods divide observations into a specified number of non-overlapping groups.

K-Means Clustering

K-means assigns each observation to the nearest cluster centroid and repeatedly updates the centroids until the assignments stabilize or another stopping rule is reached.

Its usual objective is to minimize the within-cluster sum of squares:

[
WCSS = \sum_{k=1}^{K}\sum_{x_i \in C_k}|x_i-\mu_k|^2
]

where:

  • (K) is the number of clusters
  • (C_k) is cluster (k)
  • (x_i) is observation (i)
  • (\mu_k) is the centroid of cluster (k)

Best suited to:

  • Continuous variables
  • Standardized features
  • Compact, approximately spherical clusters
  • Relatively large datasets
  • Situations in which the number of clusters can be specified

Advantages:

  • Computationally efficient
  • Easy to understand
  • Scales to large datasets
  • Produces clear centroids and hard assignments

Limitations:

  • The number of clusters must be chosen
  • Results can depend on initialization
  • Sensitive to outliers
  • Ordinary k-means is not appropriate for nominal categories
  • Performs poorly with strongly irregular shapes, unequal densities or overlapping groups

Multiple random starts or k-means++ initialization should normally be used to reduce the risk of a poor local solution.

K-Medoids Clustering

K-medoids resembles k-means but represents each cluster by an actual observation called a medoid. It can use a wider range of dissimilarity measures and is often less sensitive to extreme values.

Partitioning Around Medoids, or PAM, is a well-known k-medoids procedure.

Useful when:

  • A representative real observation is desirable
  • Robustness to outliers is important
  • A non-Euclidean dissimilarity measure is needed
  • The dataset contains mixed data represented by a suitable dissimilarity matrix

Its main disadvantage is greater computational cost than k-means.

Hierarchical Clustering

Hierarchical clustering creates a nested sequence of groups that can be visualized with a dendrogram.

Agglomerative Hierarchical Clustering

Agglomerative clustering begins with every observation in its own cluster. At each stage, the two nearest clusters are merged until all observations belong to one hierarchy.

Divisive Hierarchical Clustering

Divisive clustering begins with all observations in one group and repeatedly separates them into smaller groups.

Agglomerative methods are more common in standard statistical software.

Linkage Methods

The linkage rule defines the distance between two clusters.

Linkage methodHow cluster distance is definedTypical behavior
Single linkageSmallest distance between any pair of membersCan identify elongated structures but may create chaining
Complete linkageLargest distance between any pair of membersFavors compact clusters and is sensitive to extreme pairwise distances
Average linkageAverage pairwise distance between membersA compromise between single and complete linkage
Centroid linkageDistance between cluster centroidsCan produce dendrogram inversions
Ward’s methodIncrease in within-cluster variation caused by a mergeOften produces compact, relatively balanced clusters

Ward’s method is commonly paired with squared Euclidean distance. Researchers should verify how a software package implements Ward’s criterion because implementations and labels can differ.

Advantages of hierarchical clustering:

  • Does not require a final cluster count before constructing the hierarchy
  • Provides a dendrogram
  • Supports several distances and linkage rules
  • Useful for small and medium-sized exploratory datasets

Limitations:

  • Can be computationally demanding
  • Early merging or splitting decisions are generally not reversed
  • Sensitive to scaling, outliers and linkage choice
  • Different dendrogram cuts can produce different interpretations

Density-Based Clustering

Density-based methods identify clusters as connected regions containing many nearby observations.

DBSCAN

DBSCAN uses two principal parameters:

  • Epsilon ((\varepsilon)): the neighborhood radius
  • MinPts or min_samples: the minimum density required for a core point

It distinguishes:

  • Core points
  • Border points
  • Noise points

Advantages:

  • Does not require the number of clusters in advance
  • Can identify irregularly shaped groups
  • Explicitly labels some observations as noise
  • Useful for spatial and geospatial data

Limitations:

  • Sensitive to the choice of parameters
  • Ordinary DBSCAN struggles when clusters have substantially different densities
  • Distance becomes less informative in some high-dimensional datasets
  • Standardization and domain-informed parameter selection remain important

HDBSCAN and OPTICS extend density-based reasoning and may be more suitable for varying-density structures.

Model-Based Clustering

Model-based clustering assumes that observations were generated by a mixture of probability distributions.

Gaussian Mixture Models

A Gaussian mixture model represents the data as a weighted combination of Gaussian distributions. Instead of assigning every observation with complete certainty, it estimates a probability of belonging to each component.

Advantages:

  • Supports soft or probabilistic membership
  • Can represent ellipsoidal and overlapping groups
  • Candidate models can be compared with criteria such as BIC
  • Makes uncertainty more visible

Limitations:

  • Relies on distributional assumptions
  • Can be sensitive to initialization and model specification
  • Components do not automatically equal substantively meaningful populations
  • Very small or degenerate components may appear

Fuzzy Clustering

Fuzzy c-means assigns a degree of membership to each cluster rather than forcing each observation into exactly one group.

For example, a student could have:

  • 0.70 membership in a highly engaged profile
  • 0.25 membership in a moderate profile
  • 0.05 membership in a low-engagement profile

Fuzzy clustering is useful when boundaries are gradual rather than sharp. Its interpretation is more complex, and results depend on the fuzziness parameter and distance structure.

Spectral Clustering

Spectral clustering builds a similarity graph and uses eigenvectors of a graph-related matrix to create a representation that is then partitioned.

It can identify non-convex structures that k-means cannot capture directly. However, it requires choices about the similarity graph and may be computationally demanding for large datasets.

Clustering for Categorical and Mixed Data

K-Modes

K-modes is designed for categorical variables. It uses category modes rather than numerical means and applies a categorical dissimilarity measure.

K-Prototypes

K-prototypes combines k-means and k-modes concepts for datasets containing numerical and categorical variables.

Gower Dissimilarity With PAM or Hierarchical Clustering

Gower’s coefficient calculates pairwise similarity across mixed variable types. It can accommodate numerical, binary, nominal and ordinal information when the variables are coded and weighted appropriately.

Researchers should not assume that converting every category into dummy variables automatically makes ordinary k-means suitable.

How to Choose a Clustering Method

Data characteristics or goalMethods to considerMain caution
Compact continuous groupsK-means, Ward’s method, GMMScale variables and check outliers
Need an interpretable hierarchyAgglomerative hierarchical clusteringLinkage and dendrogram cut affect results
Irregular shapes and noiseDBSCAN, HDBSCAN, OPTICSDensity parameters require tuning
Overlapping groupsGMM, fuzzy c-meansInterpret membership uncertainty
Mixed numerical and categorical dataGower plus PAM/hierarchical, k-prototypesVariable weighting can dominate results
Purely categorical dataK-modes, latent class analysisAvoid ordinary means and Euclidean distance
Very large continuous datasetMini-batch k-means, BIRCH, scalable density methodsComputational efficiency does not guarantee meaningful clusters
Text or documentsCosine-based methods, spherical k-means, embedding-based clusteringEmbedding model and document length affect similarity
Spatial coordinatesDBSCAN, HDBSCAN, spatially constrained methodsUse an appropriate geographic distance and projection
Probabilistic interpretation neededGMM, latent class/profile modelsDistributional assumptions must be assessed

The choice should reflect the research question rather than whichever algorithm produces the most visually attractive plot.

Distance and Similarity Measures

Euclidean Distance

Euclidean distance is the straight-line distance between two observations:

[
d(x,y)=\sqrt{\sum_{j=1}^{p}(x_j-y_j)^2}
]

It is commonly used with k-means and Ward’s method.

Caution: variables with larger numerical scales can dominate the result.

Squared Euclidean Distance

[
d^2(x,y)=\sum_{j=1}^{p}(x_j-y_j)^2
]

Squaring increases the influence of large differences and is closely related to the k-means objective.

Manhattan Distance

[
d(x,y)=\sum_{j=1}^{p}|x_j-y_j|
]

Manhattan distance adds absolute coordinate differences. It may be less dominated by a single large difference than squared Euclidean distance.

Minkowski Distance

[
d(x,y)=\left(\sum_{j=1}^{p}|x_j-y_j|^q\right)^{1/q}
]

Minkowski distance is a general family. Manhattan distance occurs when (q=1), and Euclidean distance occurs when (q=2).

Cosine Distance

Cosine similarity measures the angle between two vectors:

[
\text{Cosine similarity}(x,y)=
\frac{x\cdot y}{|x||y|}
]

A common cosine distance is:

[
d_{\text{cosine}}=1-\text{Cosine similarity}
]

It is widely used for document vectors and embeddings because it emphasizes orientation rather than magnitude.

Jaccard Distance

For sets or asymmetric binary variables:

[
J(A,B)=\frac{|A\cap B|}{|A\cup B|}
]

A corresponding distance is:

[
d_J=1-J(A,B)
]

Jaccard similarity is useful when joint absences should not be treated as evidence of similarity.

Gower Dissimilarity

Gower’s measure calculates a normalized, variable-level similarity and averages across the variables for which a pair can be compared.

It is useful for mixed data, but researchers must still decide:

  • How ordinal variables are represented
  • How asymmetric binary variables are handled
  • Whether variables receive equal weights
  • How missing values are treated
  • Whether all variables are substantively comparable

Mahalanobis Distance

Mahalanobis distance accounts for covariance:

[
d_M(x,y)=\sqrt{(x-y)^TS^{-1}(x-y)}
]

where (S) is a covariance matrix.

It can reduce the effect of correlated scale directions, but estimating and inverting the covariance matrix may be difficult with many variables, small samples or strong multicollinearity.

Data Requirements and Assumptions

Cluster analysis does not have one universal set of assumptions. Each algorithm has its own requirements.

Relevant Variables

The variables should represent the construct or behavior that defines meaningful similarity for the research problem.

Including an identifier, postcode fragment, administrative code or redundant measurement can cause clusters to reflect data-management artifacts rather than the intended construct.

Comparable Scales

When numerical variables use different units, standardization is often necessary.

The z-score is:

[
z_{ij}=\frac{x_{ij}-\bar{x}_j}{s_j}
]

where (\bar{x}_j) and (s_j) are the mean and standard deviation of variable (j).

Other transformations include:

  • Min–max scaling
  • Robust scaling with medians and interquartile ranges
  • Logarithmic transformation
  • Rank transformation
  • Domain-specific normalization

Standardization should not be automatic. If a one-unit difference has a meaningful and comparable interpretation across variables, preserving the original scale may be justified.

Missing Data

Many clustering implementations require complete values. Deleting all incomplete observations can reduce the sample and introduce bias if the missingness is systematic.

Possible approaches include:

  • Investigating the missing-data mechanism
  • Multiple imputation
  • Model-based handling
  • Pairwise dissimilarity methods
  • Sensitivity analysis across plausible treatments

Imputation should occur within a reproducible analytical pipeline. Researchers should avoid using outcome or future information that would create leakage.

Outliers

Outliers may:

  • Pull k-means centroids away from dense regions
  • Form singleton or very small clusters
  • Change the dendrogram substantially
  • Distort scale estimates
  • Be scientifically important rather than erroneous

Researchers should identify why an observation is unusual before removing it. Robust methods, transformation, winsorization, k-medoids or density-based clustering may be considered where appropriate.

Independence and Duplicate Records

Exact or near-duplicate observations can overweight certain patterns. Repeated measurements from the same person may also violate an implicit assumption that each row represents a comparable independent unit.

Longitudinal observations may require:

  • Subject-level feature engineering
  • Time-series clustering
  • Trajectory models
  • Multilevel methods
  • Sequence analysis

Clusterability

Not every dataset contains meaningful groups.

Researchers can examine:

  • Pairwise-distance distributions
  • Visual assessment
  • Hopkins-type statistics
  • VAT or ordered dissimilarity displays
  • Comparisons with suitable null data
  • Stability across samples
  • Substantive plausibility

No single clusterability check is decisive. The assessment should consider the kind of structure the proposed algorithm is capable of finding.

Sample Size

There is no universal minimum sample size for cluster analysis.

Required sample size depends on:

  • Number of variables
  • Number and relative size of groups
  • Separation between groups
  • Noise and outliers
  • Correlation structure
  • Algorithm
  • Validation strategy

Simulation studies can assist planning. A numerical recommendation obtained under well-separated simulated groups should not be transferred uncritically to high-dimensional, overlapping or imbalanced real data.

How to Perform Cluster Analysis: Step by Step

Step 1: Define the Research Objective

State why clustering is needed.

A useful objective is:

To identify reproducible patterns of student engagement based on attendance, independent study, learning-platform activity and assessment preparation.

A weak objective is:

To run cluster analysis and see what happens.

Clarify whether the goal is:

  • Exploratory description
  • Segmentation
  • Anomaly detection
  • Data reduction
  • Hypothesis generation
  • Construction of a typology
  • Support for a later prediction system

Step 2: Define the Unit of Analysis

Specify what one row represents:

  • One participant
  • One hospital
  • One school
  • One document
  • One transaction
  • One geographical area
  • One time series

Do not mix incompatible units in the same clustering matrix.

Step 3: Select and Justify Variables

Include variables that are theoretically and operationally relevant to the clustering objective.

Check for:

  • Duplicated variables
  • Near-perfect correlations
  • Variables that indirectly reveal a protected or irrelevant attribute
  • Derived variables that repeat the same information
  • Features measured after the event being studied
  • Extreme imbalance in the number of indicators per construct

When one construct has ten indicators and another has one, the first construct may dominate the distance unless variables are reduced or weighted.

Step 4: Clean and Transform the Data

Document:

  • Missing-data treatment
  • Outlier decisions
  • Transformations
  • Standardization
  • Categorical encoding
  • Variable weighting
  • Dimensionality reduction

All transformations should be reproducible.

Step 5: Explore Whether Cluster Structure Is Plausible

Use descriptive statistics, plots, distance patterns and domain knowledge.

For high-dimensional data, two-dimensional PCA or UMAP plots may help visualization, but they do not prove the existence of clusters. A projection can create, hide or exaggerate separation.

Step 6: Choose the Distance and Algorithm

Match the method to:

  • Variable type
  • Expected geometry
  • Noise
  • Dataset size
  • Need for hard or soft membership
  • Desired interpretability
  • Intended use

When the structure is uncertain, compare several theoretically plausible methods.

Step 7: Tune Parameters and Candidate Cluster Counts

Depending on the method, examine:

  • Candidate values of (K)
  • Random initializations
  • Linkage rules
  • Dendrogram cuts
  • DBSCAN epsilon and minimum-points values
  • Covariance structures for mixture models
  • Fuzziness parameters
  • Neighborhood definitions for spectral methods

Keep a record of all tried specifications rather than reporting only the preferred result.

Step 8: Evaluate Validity and Stability

Use several forms of evidence:

  • Within-cluster cohesion
  • Between-cluster separation
  • Silhouette width
  • Calinski–Harabasz index
  • Davies–Bouldin index
  • Gap statistic
  • Model information criteria
  • Bootstrap or subsampling stability
  • Replication in a holdout sample
  • External-variable comparisons
  • Practical interpretability

Step 9: Profile and Interpret the Clusters

Describe each cluster using:

  • Cluster size
  • Means or medians
  • Category proportions
  • Standardized profiles
  • Representative observations
  • Membership uncertainty
  • Variables not used to create the clusters

Use neutral names such as “high digital engagement” rather than judgmental labels such as “good students.”

Step 10: Report Decisions and Uncertainty

Report enough detail for another analyst to reproduce the analysis:

  • Software and version
  • Package or procedure
  • Variables
  • Preprocessing
  • Distance measure
  • Algorithm
  • Parameters
  • Number of starts
  • Random seed
  • Selection criteria
  • Validation results
  • Final cluster sizes
  • Sensitivity analyses
  • Interpretation limitations

How Do You Choose the Number of Clusters?

No single method always identifies the correct number of clusters. Use a range of evidence.

Elbow Method

The elbow method plots within-cluster variation against (K). The preferred solution is often near a point after which additional clusters produce diminishing improvement.

Limitation: many plots do not contain a clear elbow, and analyst judgment is required.

Silhouette Analysis

For observation (i):

  • (a(i)) is its average dissimilarity to members of its own cluster.
  • (b(i)) is the lowest average dissimilarity to another cluster.

The silhouette width is:

[
s(i)=\frac{b(i)-a(i)}{\max{a(i),b(i)}}
]

Values approach:

  • 1: the observation is much closer to its own cluster
  • 0: it lies near a boundary
  • −1: it may fit another cluster better

Average silhouette width can compare candidate solutions, but it favors certain geometric structures and should not be the sole decision rule.

Gap Statistic

The gap statistic compares observed within-cluster dispersion with dispersion expected under a reference distribution without comparable cluster structure.

It is more principled than simply minimizing within-cluster variation, which always improves as more clusters are added.

Its result still depends on the reference distribution, algorithm and feature representation.

Dendrogram

In hierarchical clustering, a horizontal cut through the dendrogram produces a selected number of clusters. Large jumps in merge height may suggest meaningful separation.

A dendrogram must be interpreted with the linkage method, scale and substantive purpose in mind.

Information Criteria

For mixture models, information criteria such as BIC can compare candidate component counts and covariance structures.

The best-fitting number of statistical components may not equal the most useful number of substantive groups.

Stability

A solution is more credible when similar clusters appear after:

  • Bootstrap resampling
  • Subsampling
  • Data splitting
  • Small preprocessing changes
  • Alternative random starts
  • Replication in a new sample

Substantive Usefulness

A statistically strong solution may be impractical if it creates:

  • Tiny unusable clusters
  • Groups with no meaningful distinction
  • Profiles that cannot be acted upon
  • Categories that cannot be replicated or assigned prospectively

The final choice should balance empirical evidence with the research objective.

How Is Cluster Analysis Validated?

Internal Validation

Internal metrics use only the clustering variables.

Silhouette Coefficient

Higher values generally indicate better cohesion and separation, subject to the metric’s assumptions.

Calinski–Harabasz Index

This index compares between-cluster dispersion with within-cluster dispersion. Higher values are preferred when comparing solutions fitted to the same data representation.

Davies–Bouldin Index

This index summarizes within-cluster scatter relative to separation from the most similar cluster. Lower values are generally preferred.

Internal metrics should not be compared casually across different datasets, incompatible distance definitions or radically different preprocessing pipelines.

External Validation

External validation compares the clustering with information not used to create it.

Examples include:

  • A known reference classification
  • Later outcomes
  • Independent clinical measures
  • Expert assessment
  • Geographic information
  • Behavioral measures collected separately

External differences do not automatically prove the clusters are valid. Researchers should explain why the external variable is relevant and avoid selecting only favorable comparisons.

Relative Validation

Relative validation compares candidate solutions generated by different:

  • Values of (K)
  • Algorithms
  • Linkage methods
  • Distance measures
  • Parameter combinations

Stability Validation

Stability asks whether minor changes in the sample or analysis lead to similar memberships.

Possible statistics include:

  • Adjusted Rand index between solutions
  • Jaccard similarity of matched clusters
  • Consensus matrices
  • Co-clustering probabilities
  • Cluster-wise stability measures

Label numbers must be aligned before comparing solutions because “Cluster 1” in one run may correspond to “Cluster 3” in another.

Practical and Substantive Validation

A useful cluster should be:

  • Understandable
  • Distinct enough to matter
  • Large enough for the intended application
  • Consistent with plausible theory or domain evidence
  • Stable enough to support decisions
  • Ethical to use

Statistical separation alone is insufficient.

Worked Example of Cluster Analysis

Research Question

A university wants to identify patterns of academic engagement among 600 undergraduate students.

Variables

The analysis uses:

  • Weekly independent-study hours
  • Attendance percentage
  • Number of learning-platform sessions
  • Percentage of assessments submitted early
  • Participation in optional tutorials

Student identity, nationality, gender and final degree classification are not used to construct the clusters.

Preprocessing

The researcher:

  1. Examines missingness and uses a justified imputation strategy.
  2. Investigates implausible activity counts.
  3. Applies a logarithmic transformation to strongly skewed platform-session counts.
  4. Standardizes the five clustering variables.
  5. Retains final grades as an external validation variable rather than a clustering input.

Candidate Methods

The researcher compares:

  • K-means with multiple random starts
  • Ward’s hierarchical clustering
  • Gaussian mixture models

Candidate solutions with two through six groups are evaluated.

Selection Evidence

The results show:

  • A weak elbow at four clusters
  • Better average silhouette width for three and four clusters
  • Four interpretable branches in the Ward dendrogram
  • Reasonable stability for four clusters under repeated subsampling
  • A four-component mixture model with acceptable information criteria
  • No extremely small group

The four-cluster solution is selected because several lines of evidence converge. The decision is not based only on the highest value of one index.

Cluster Profiles

ClusterDescriptive profileInterpretation
1High attendance, high study time, frequent platform use and early submissionsBroadly engaged
2Moderate attendance and study time, very high platform useDigitally engaged
3High attendance but lower independent study and platform useClassroom-oriented
4Low values on most engagement indicatorsLower observed engagement

External Validation

Final grades are compared after the clusters have been formed. Cluster 1 has the highest median grade, but there is considerable overlap among all four groups.

The researcher therefore concludes that the clusters describe engagement patterns; they are not deterministic categories of academic ability.

Responsible Interpretation

The university should not automatically use the clusters to penalize or rank students. Low recorded platform use may reflect offline study, accessibility issues, employment commitments or data-capture limitations.

The results may instead guide optional support and further qualitative investigation.

How to Interpret and Name Clusters

Examine Standardized Profiles

Plot the mean or median standardized score for each variable within every cluster. This shows which features distinguish the groups.

Consider Cluster Size

A very small cluster might represent:

  • A meaningful rare subgroup
  • Outliers
  • Data errors
  • Overfitting
  • An excessively large value of (K)

Do not delete a small group only because it is inconvenient.

Inspect Representative and Borderline Observations

A centroid, medoid or high-membership observation can help explain the typical profile.

Borderline observations reveal where distinctions are weak. In a mixture or fuzzy solution, report membership uncertainty rather than presenting every assignment as certain.

Use External Variables Carefully

Variables not used to construct the clusters can help determine whether the groups have meaningful differences.

When the same clustering variables are compared across the resulting clusters, large differences are expected because those variables created the groups. Such comparisons describe the solution but do not independently validate it.

Avoid Essentialist Labels

Cluster names are summaries, not inherent identities.

Prefer:

  • Higher recorded engagement
  • Price-sensitive frequent purchasers
  • Urban high-access areas
  • Mixed symptom profile

Avoid:

  • Bad students
  • Unhealthy people
  • Low-value customers
  • Problem neighborhoods

Names should reflect measured data, not moral judgments or unsupported assumptions.

How to Report Cluster Analysis

A methods section should identify:

  1. The purpose of clustering
  2. Unit of analysis
  3. Variables and their justification
  4. Missing-data procedure
  5. Transformations and scaling
  6. Distance or similarity measure
  7. Algorithm and parameters
  8. Candidate cluster counts
  9. Initialization and random seed
  10. Selection and validation criteria
  11. Sensitivity and stability analyses
  12. Software, package and version

Example Methods Paragraph

Cluster analysis was conducted to identify patterns of academic engagement. Five indicators—attendance, weekly independent-study hours, learning-platform sessions, optional-tutorial participation and early assessment submission—were standardized as z-scores. Strongly skewed session counts were log-transformed before standardization. K-means solutions containing two to six clusters were estimated using k-means++ initialization, 100 random starts and a fixed random seed. Candidate solutions were compared using within-cluster sum of squares, average silhouette width, cluster sizes, interpretability and stability under repeated 80% subsampling. A four-cluster solution was retained because it showed acceptable separation, stable membership patterns and substantively distinct profiles.

Example Results Paragraph

The four-cluster solution contained 182, 151, 143 and 124 students. Cluster 1 showed above-average values on all five engagement indicators and was labelled “broadly engaged.” Cluster 2 showed especially high digital-platform use but approximately average attendance and was labelled “digitally engaged.” Cluster 3 showed high attendance but lower digital and independent-study indicators and was labelled “classroom-oriented.” Cluster 4 showed below-average recorded engagement across most indicators. The overall average silhouette width was reported alongside cluster-wise values. Subsampling indicated that Clusters 1 and 4 were more stable than Clusters 2 and 3. Cluster labels were treated as descriptive rather than fixed student types.

Results to Present

Useful tables and figures include:

  • Cluster sizes
  • Cluster-wise means or medians
  • Standardized profile plot
  • Silhouette plot
  • Dendrogram
  • Two-dimensional visualization clearly labelled as a projection
  • Stability matrix
  • External-variable comparison
  • Membership-probability summary for soft clustering

Applications of Cluster Analysis in Modern Research

Health and Medicine

Researchers use clustering to explore:

  • Symptom profiles
  • Patient phenotypes
  • Treatment-response patterns
  • Healthcare-utilization patterns
  • Biomarker profiles

Clinical clusters require cautious validation. A statistically distinct group is not automatically a disease subtype, and findings should be replicated in independent samples.

Psychology and Social Science

Applications include:

  • Behavioral profiles
  • Attitude patterns
  • Lifestyle typologies
  • Community detection
  • Household classifications
  • Response-style analysis

When clustering questionnaire items or scale scores, measurement validity should be established before interpreting the clusters.

Education

Researchers may identify:

  • Engagement patterns
  • Learning-strategy profiles
  • Course-participation patterns
  • Institutional groups
  • Student-support needs

Educational clusters should not be used as fixed ability labels.

Biology and Bioinformatics

Clustering is used for:

  • Gene-expression profiles
  • Protein patterns
  • Cell populations
  • Species similarity
  • Ecological communities

High dimensionality, batch effects and preprocessing choices are particularly important in these applications.

Market and Consumer Research

Common applications include:

  • Customer segmentation
  • Product grouping
  • Purchasing profiles
  • Store classifications
  • Media-consumption patterns

A segment is useful only if it is measurable, reachable, sufficiently stable and linked to an appropriate action.

Geography and Environmental Research

Cluster analysis can identify:

  • Spatial hotspots
  • Land-use patterns
  • Climate regions
  • Pollution profiles
  • Similar ecological sites

Ordinary Euclidean analysis may be inappropriate when spatial adjacency, geographic projection or spatial dependence matters.

Document and Text Analysis

Documents can be represented using:

  • Term-frequency vectors
  • TF–IDF
  • Topic distributions
  • Sentence or document embeddings

Clustering can organize literature, news, interview transcripts or open-ended survey responses. The final groups depend heavily on text preprocessing and the chosen embedding model.

Digital Tools, Artificial Intelligence and Recent Practices

R

Common R functions and packages include:

  • stats::kmeans()
  • stats::hclust()
  • cluster::pam()
  • cluster::clara()
  • cluster::silhouette()
  • dbscan
  • mclust
  • factoextra

R is especially strong for statistical diagnostics, visualization and reproducible reports.

Python

Common Python tools include:

  • scikit-learn
  • scipy.cluster
  • hdbscan
  • pandas
  • numpy
  • matplotlib
  • yellowbrick

Scikit-learn provides implementations of k-means, agglomerative clustering, DBSCAN, HDBSCAN, spectral clustering, BIRCH and validation metrics.

SPSS

IBM SPSS Statistics includes:

  • Hierarchical cluster analysis
  • K-means cluster analysis
  • TwoStep clustering

TwoStep can be useful for combinations of categorical and continuous variables, but researchers should understand its distance and model assumptions rather than relying only on automatic cluster selection.

SAS, Stata and Minitab

These packages provide established procedures for hierarchical and partitioning methods. Researchers should record the exact command, options, standardization and linkage choices because defaults differ.

No-Code Tools

KNIME and other workflow platforms allow clustering through visual pipelines. No-code execution improves accessibility but does not eliminate the need to justify preprocessing, algorithms and validation.

AI-Assisted Analysis

Generative AI can help researchers:

  • Draft R or Python code
  • Explain software output
  • Create validation checklists
  • Translate an analysis between software packages
  • Suggest visualizations
  • Identify undocumented analytical decisions

It should not be trusted to:

  • Decide that clusters are scientifically real
  • Select variables without domain reasoning
  • Invent interpretations
  • Verify calculations it has not executed
  • Generate references without checking them
  • Handle confidential data without an approved environment

All AI-generated code should be tested, version-controlled and reviewed.

Embeddings and Clustering

Modern language and vision models can transform text or images into numerical embeddings. Researchers can then cluster the embeddings using cosine-based, centroid, density or graph methods.

This workflow introduces additional choices:

  • Embedding model
  • Input preprocessing
  • Chunk length
  • Pooling strategy
  • Dimensionality reduction
  • Distance measure
  • Algorithm
  • Validation against human judgment

An embedding is not a neutral representation. It reflects the training data and objectives of its model.

Reproducibility Practices

A reproducible clustering analysis should preserve:

  • Raw-data provenance
  • Data-cleaning code
  • Feature-construction code
  • Scaling parameters
  • Random seed
  • Software versions
  • Full parameter grid
  • Candidate solutions
  • Validation outputs
  • Cluster-label mapping
  • Final interpretation rules

When the clusters will be used prospectively, the researcher must also specify how new observations will be transformed and assigned.

Advantages of Cluster Analysis

  • Reveals patterns without predefined labels
  • Summarizes complex multivariate data
  • Supports hypothesis generation
  • Accommodates several definitions of similarity
  • Can identify unusual observations
  • Supports segmentation and typology development
  • Integrates with visualization and dimensionality reduction
  • Offers hard, soft, hierarchical and density-based alternatives
  • Can be applied to numerical, categorical, mixed, spatial and text data with suitable methods

Limitations of Cluster Analysis

  • Results depend on variables, scaling, distance and algorithm
  • Many algorithms return clusters even in unstructured data
  • There may be several reasonable solutions
  • Internal indices can favor particular geometries
  • Outliers can distort results
  • High dimensionality can weaken distance-based separation
  • Cluster labels can encourage overgeneralization
  • Small groups may be unstable
  • Replication may be difficult
  • Statistical clusters may lack practical meaning
  • Exploratory groups do not establish causality
  • Ethical harm can arise when clusters are used to profile people

Common Mistakes

Using K-Means for Every Dataset

K-means is not a universal default. It is poorly matched to nominal categories, strong outliers, irregular shapes and substantially varying densities.

Failing to Standardize Variables

A variable measured in thousands can dominate one measured from 1 to 5, even when the numerical scale has no substantive priority.

Standardizing Without Thinking

Equal variance does not always mean equal scientific importance. Standardization changes the question from similarity in original units to similarity in standardized deviations.

Choosing (K) Only From the Elbow Plot

The elbow may be ambiguous. Combine it with other metrics, stability and interpretability.

Treating a Two-Dimensional Plot as Proof

PCA, t-SNE and UMAP plots are projections. Visible separation in two dimensions may not reflect the complete feature space.

Interpreting Cluster Numbers as Ordered

Cluster 4 is not inherently higher or better than Cluster 2. The numbers are arbitrary identifiers.

Naming Clusters From Stereotypes

Names should describe observed profiles, not assign motives, value or identity.

Ignoring Instability

A cluster that disappears under minor data changes should not support strong substantive claims.

Validating With the Same Variables

Differences on clustering variables are expected. Use separate outcomes, expert review, replication or resampling for stronger validation.

Reporting Only the Preferred Model

Selective reporting hides analytical flexibility. Report the candidate methods and criteria that led to the final choice.

Conclusion

Cluster analysis is a flexible family of exploratory methods for grouping similar observations, but a clustering result is not produced by the algorithm alone. It reflects the research objective, selected variables, preprocessing, similarity measure, algorithm and validation strategy.

A credible analysis uses methods appropriate to the data, compares plausible alternatives, assesses stability and avoids treating descriptive groups as permanent natural categories. The strongest solution is not simply the one with the highest score; it is the one that is empirically defensible, reproducible, interpretable and useful for the stated research purpose.

References

  • Dalmaijer, E. S., Nord, C. L., & Astle, D. E. (2022). Statistical power for cluster analysis. BMC Bioinformatics, 23, Article 205. https://doi.org/10.1186/s12859-022-04675-1
  • Ester, M., Kriegel, H.-P., Sander, J., & Xu, X. (1996). A density-based algorithm for discovering clusters in large spatial databases with noise. In Proceedings of the Second International Conference on Knowledge Discovery and Data Mining (pp. 226–231). AAAI Press.
  • Everitt, B. S., Landau, S., Leese, M., & Stahl, D. (2011). Cluster analysis (5th ed.). Wiley.
  • Gower, J. C. (1971). A general coefficient of similarity and some of its properties. Biometrics, 27(4), 857–871. https://doi.org/10.2307/2528823
  • Hennig, C. (2015). What are the true clusters? Pattern Recognition Letters, 64, 53–62. https://doi.org/10.1016/j.patrec.2015.04.009
  • Jain, A. K. (2010). Data clustering: 50 years beyond k-means. Pattern Recognition Letters, 31(8), 651–666. https://doi.org/10.1016/j.patrec.2009.09.011
  • Kaufman, L., & Rousseeuw, P. J. (1990). Finding groups in data: An introduction to cluster analysis. Wiley. https://doi.org/10.1002/9780470316801
  • MacQueen, J. (1967). Some methods for classification and analysis of multivariate observations. In L. M. Le Cam & J. Neyman (Eds.), Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability (Vol. 1, pp. 281–297). University of California Press.
  • Rousseeuw, P. J. (1987). Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. Journal of Computational and Applied Mathematics, 20, 53–65. https://doi.org/10.1016/0377-0427(87)90125-7
  • Tibshirani, R., Walther, G., & Hastie, T. (2001). Estimating the number of clusters in a data set via the gap statistic. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 63(2), 411–423. https://doi.org/10.1111/1467-9868.00293
  • Ward, J. H., Jr. (1963). Hierarchical grouping to optimize an objective function. Journal of the American Statistical Association, 58(301), 236–244. https://doi.org/10.1080/01621459.1963.10500845

About the author

Muhammad Hassan

Muhammad Hassan writes about research design, academic methods and data-analysis concepts for ResearchMethod.net. His work focuses on presenting methodological topics in clear language for students and early-career researchers. Articles are developed from recognized methodological literature and official software documentation.