Imagine you have survey data from 300 customers and you suspect they fall into a few natural groups — budget shoppers, brand loyalists, and occasional buyers — but nobody labelled them for you. That is exactly what cluster analysis does: it finds hidden groups in your data so you can describe them, compare them, and act on them. In this tutorial you will learn how to run cluster analysis in SPSS using both of its main methods, hierarchical clustering and k-means clustering, how to read the output, and how to report your results in APA style (7th ed.).
What cluster analysis does
Cluster analysis is an unsupervised technique: unlike regression or ANOVA, there is no dependent variable and no outcome to predict. Instead, SPSS measures how similar your cases are to each other across the variables you choose, then groups the most similar cases together. Cases in the same cluster should be as similar as possible, while different clusters should be as different as possible.
Typical uses include segmenting customers by buying behaviour, grouping patients by symptom patterns, or profiling students by study habits. The groups you find can then become the starting point for further analysis — for example, comparing the clusters on an outcome variable, as shown in our MANOVA in SPSS tutorial.
SPSS offers two main approaches. Hierarchical clustering builds a tree of nested groups and is best when you do not yet know how many clusters there are. K-means clustering is faster and suits larger datasets, but you must tell SPSS how many clusters to find in advance. A common workflow is to use hierarchical clustering first to choose the number of clusters, then run k-means to refine the solution.
Before you start: preparing your data
Cluster analysis is sensitive to the scale of your variables, so preparation matters more here than in most other tests. Work through these checks first:
- Use continuous variables. Both methods in this tutorial are designed for interval or ratio variables, such as age, income, or scale scores. If your grouping variables are categorical, look at two-step cluster analysis instead.
- Put variables on a comparable scale. A variable measured in thousands (income) will dominate one measured in single digits (a 1–5 rating) unless you standardise. Convert variables to z-scores first with Analyze > Descriptive Statistics > Descriptives, ticking “Save standardized values as variables”. See our 9-step data preparation checklist for the full routine.
- Deal with missing values. SPSS drops cases with missing values on any clustering variable, so check how many cases you would lose before you start.
- Check for extreme outliers. Because clustering is based on distances between cases, a single extreme case can distort the whole solution. Screen with boxplots or z-scores and decide, on substantive grounds, whether an outlier belongs in the analysis.
For this tutorial, imagine a dataset with three standardised variables describing customers: shopping frequency, average spend, and price sensitivity. The same steps apply to any set of continuous variables.
Method 1: Hierarchical cluster analysis in SPSS
Hierarchical clustering starts with every case as its own cluster, then repeatedly merges the two most similar clusters until everything is one big group. The result is a dendrogram — a tree diagram that shows exactly where the merges happened.
Step-by-step: running hierarchical clustering
- Click Analyze > Classify > Hierarchical Cluster.
- Move your clustering variables into the Variables box.
- Under Cluster, make sure Cases is selected (you are grouping people, not variables).
- Click Method. In the Cluster Method dropdown, choose Ward’s method — it tends to produce compact, evenly sized clusters and is the most widely used choice. In the Measure section, choose Squared Euclidean distance (the correct distance measure to pair with Ward’s method). Click Continue.
- Click Statistics and tick Agglomeration schedule. Click Continue.
- Click Plots and tick Dendrogram. Click Continue.
- Click Save, choose Single solution, and enter the number of clusters you want saved as a new variable (you will decide this number after inspecting the output — start with a reasonable guess and re-run if needed). Click Continue, then OK.
SPSS syntax for hierarchical clustering
The same analysis in syntax, saving a three-cluster solution:
CLUSTER age income spend /METHOD WARD /MEASURE=SEUCLID /PRINT SCHEDULE /PLOT DENDROGRAM /SAVE CLUSTER(3).
Replace the variable names with your own. Change the number in /SAVE CLUSTER(3) to save a different number of clusters.
Interpreting the hierarchical output
Two tables do most of the work. The Agglomeration Schedule lists every merge and its coefficient — the distance at which two clusters were joined. Read the Coefficients column from the bottom up: you are looking for a large jump between one stage and the next. A big jump means two quite dissimilar clusters were forced together, so the solution just before that jump is usually the right number of clusters. For example, if the coefficient rises gradually and then jumps sharply, the number of clusters present before the jump is a sensible choice.
The dendrogram shows the same information visually. Long horizontal lines mean clusters that stayed separate for a long time before merging — cut the tree where the branches are long and you have your clusters. Short branches near the right of the diagram are cases that merged early because they are very similar.
The saved cluster-membership variable (named QCL_1 by default) lets you profile each cluster: run Descriptives or Compare Means on your original variables split by this new variable to see what makes each group distinctive.
Method 2: K-means cluster analysis in SPSS
K-means works the other way round: you choose the number of clusters first, SPSS picks starting centres, assigns each case to the nearest centre, then moves the centres and reassigns cases until the solution stabilises. It is much faster than hierarchical clustering on large datasets.
Step-by-step: running k-means clustering
- Click Analyze > Classify > K-Means Cluster.
- Move your clustering variables into the Variables box.
- In Number of Clusters, enter the number you chose from the hierarchical analysis — for example, 3.
- Click Iterate. The defaults (Maximum Iterations 10, Convergence Criterion 0) are fine for most datasets; raise the maximum iterations if the solution does not converge. Click Continue.
- Click Save and tick Cluster membership. This saves a variable (QCL_1) showing which cluster each case belongs to. Click Continue.
- Click Options and tick Initial cluster centers, ANOVA table, and Cluster information for each case. Click Continue, then OK.
SPSS syntax for k-means clustering
QUICK CLUSTER age income spend /MISSING=LISTWISE /CRITERIA=CLUSTER(3) MXITER(10) CONVERGE(0) /METHOD=KMEANS(NOUPDATE) /SAVE CLUSTER /PRINT INITIAL ANOVA CLUSTER DISTAN.
Change CLUSTER(3) to the number of clusters you want, and replace the variable names with your own.
Interpreting the k-means output
Iteration History shows how far the cluster centres moved at each step. The solution has converged when the change reaches zero or the maximum number of iterations is reached. If it hits the iteration limit without converging, raise the maximum iterations and re-run.
Final Cluster Centers is the most useful table: it gives the mean of each variable within each cluster. Read across a row to build a profile — for instance, one cluster may score high on shopping frequency and spend but low on price sensitivity, while another shows the opposite pattern. Give each cluster a plain descriptive label based on this profile, such as “frequent high-spenders”.
Number of Cases in each Cluster shows how many cases landed in each group. Very small clusters deserve a second look: they may be a genuine niche group, or they may be a handful of outliers the algorithm isolated. Also check the ANOVA table, but interpret it with care — the F values there are descriptive only. Because k-means deliberately forms clusters that maximise differences between groups, these F tests cannot be read as significance tests. Use them only to see which variables contributed most to separating the clusters.
Hierarchical vs k-means: which should you use?
| Hierarchical clustering | K-means clustering | |
|---|---|---|
| Number of clusters | Decided after inspecting the dendrogram | You must specify it in advance |
| Best for | Smaller datasets; exploring the structure | Larger datasets; refining a known solution |
| Output | Dendrogram and agglomeration schedule | Final cluster centres and cluster sizes |
| Speed | Slower on large samples | Fast, even with thousands of cases |
| Stability | Same result every run | Can vary with starting centres |
In practice, the two methods complement each other: run hierarchical clustering on a sample of your data to find the number of clusters, then run k-means on the full dataset with that number. If both methods produce similar groupings, your solution is more trustworthy.
Validating and profiling your clusters
A cluster solution is only useful if the groups are meaningful, so always validate them. First, profile each cluster on variables you did not use to form it — for example, cross-tabulate cluster membership with gender or region, or compare the clusters on an outcome variable. If the clusters differ sensibly on outside variables, the solution has face validity. Second, check stability: run the analysis on a random half of your data and see whether a similar structure appears, or compare the hierarchical and k-means solutions case by case. Third, test whether the clusters actually differ on your outcomes — MANOVA is a natural next step when you have several outcome variables, and our exploratory factor analysis tutorial explains the related technique for grouping variables rather than cases — a common point of confusion for beginners.
Reporting in APA style (7th ed.)
There is no single APA format for cluster analysis, so report the decisions a reader would need to reproduce your work: the variables entered, whether they were standardised, the distance measure and linkage method (hierarchical) or the number of clusters and iteration settings (k-means), and how you chose the number of clusters. Then describe each cluster by its profile and size.
Example wording you can adapt:
A hierarchical cluster analysis (Ward’s method, squared Euclidean distance) was conducted on standardised scores for shopping frequency, average spend, and price sensitivity. Inspection of the agglomeration schedule and dendrogram supported a three-cluster solution, which was refined with k-means clustering. Cluster 1 (n = …) was characterised by high shopping frequency and high average spend; Cluster 2 (n = …) showed moderate frequency with high price sensitivity; and Cluster 3 (n = …) showed low frequency and low spend. The clusters differed on [outcome variable], providing support for the validity of the solution.
Fill in your own sample sizes and profiles. Report cluster sizes (n) for every cluster, name the method and distance measure, and describe each cluster in words rather than listing raw centre values without interpretation. Do not report the k-means ANOVA F values as significance tests — as noted above, they are descriptive only.
Key Takeaways
- Cluster analysis finds natural groupings of cases; there is no dependent variable and nothing is predicted.
- Standardise your variables first when they are measured on different scales, and screen for outliers — distances drive everything.
- Use hierarchical clustering (Ward’s method, squared Euclidean distance) with the dendrogram and agglomeration schedule to choose the number of clusters.
- Use k-means clustering to refine the solution on larger datasets, and read the Final Cluster Centers table to profile each group.
- Never interpret the k-means ANOVA table as a significance test — its F values are descriptive only.
- Validate your clusters by profiling them on variables not used to form them, and report the method, distance measure, cluster sizes, and profiles in APA style.
Frequently asked questions
What is the difference between cluster analysis and factor analysis?
Cluster analysis groups cases (people, customers, patients) that are similar to each other. Factor analysis groups variables that correlate with each other, reducing many items to a few underlying dimensions. If you want to segment your respondents, use cluster analysis; if you want to reduce questionnaire items to subscales, use factor analysis — see our EFA tutorial.
How do I know how many clusters to choose?
Run hierarchical clustering first and look for a large jump in the agglomeration schedule coefficients, or a long branch in the dendrogram. That jump marks the point where dissimilar clusters were forced together. There is no significance test for the number of clusters, so combine this evidence with interpretability: a solution is only useful if you can describe each cluster clearly.
Do my variables need to be standardised?
Yes, whenever they are on different scales. Without standardisation, a variable with a large range (income in thousands) will dominate one with a small range (a 1–5 rating) simply because its numbers are bigger. Use Analyze > Descriptive Statistics > Descriptives with “Save standardized values as variables” before clustering.
Can I use categorical variables in cluster analysis?
Not with the hierarchical and k-means procedures in this tutorial — both are designed for continuous variables. If your grouping variables are categorical, or a mix of categorical and continuous, use two-step cluster analysis (Analyze > Classify > TwoStep Cluster) instead.
What should I do if one cluster is very small?
First check whether the small cluster is a handful of outliers — if so, consider whether those cases belong in the analysis at all. If the cases are genuine, a small cluster may still be meaningful (a niche segment, for example). Report its size honestly and avoid over-interpreting a group built on very few cases.
Related guides
- Exploratory Factor Analysis (EFA) in SPSS: How to Run and Interpret It
- MANOVA in SPSS: Testing Several Outcomes at Once
- SPSS Data Preparation: The 9-Step Checklist Before Any Analysis
Need professional guidance with your SPSS analysis? Contact us → /services/