K-means cluster analysis
Splits cases into a chosen number of groups so that cases in a group are close to the group centre on the chosen variables.
Menu: Analyze → Classify → K-Means Cluster…
When should I use it?
- Segment customers into three spending profiles.
- Group schools by several performance indicators.
What are the assumptions?
- Numeric variables on comparable scales (standardize first if units differ).
- You choose k; try several values and compare interpretability.
- Clusters roughly round and of similar spread; results depend on the starting centres.
How do I run it in StatLab?
- Move the variables in (standardized versions if their scales differ).
- Enter the number of clusters.
- Raise the maximum iterations if the iteration history shows centres still moving.
- Save cluster membership to profile the clusters with other variables.
- Tick Use running means to update each cluster centre after every case is assigned, instead of after a complete pass.
How do I read the output?
| Output | Meaning |
|---|---|
| Initial Cluster Centers | Starting points chosen from the data. |
| Iteration History | How far centres moved each iteration. |
| Final Cluster Centers | Mean of each variable in each cluster — use to name clusters. |
| ANOVA | Which variables separate the clusters most (descriptive only). |
| Number of Cases in each Cluster | Cluster sizes. |
Worked example
On the practice survey dataset (File → Sample dataset), this command — which the dialog's Paste button also produces — runs the procedure:
PROC glmKMeans /vars=(score age) /k=2 /maxIter=10 /running=NO /anova=YES /member=NO /save=NO.
Output tables: Initial Cluster Centers · Iteration History · Final Cluster Centers · Distances between Final Cluster Centers · ANOVA · Number of Cases in each Cluster.
How would I report it in APA style?
A k-means cluster analysis on Wellbeing score, Age (years) (N = 150) formed 2 clusters of 71, 79 cases and converged in 2 iterations.
Computed by StatLab's validated procedure code when this page was built. The example only illustrates the steps; choose variables that fit your own research question.
What are common mistakes?
- Reading the ANOVA Sig. values as tests — the clusters were built to differ.
- Clustering variables with very different units without standardizing.