Which groups are in the data? (cluster analysis)
In brief
You want to know whether cases can be divided into groups that are alike on several numbers - for example students by motivation, anxiety and study time. Statable offers Ward's method (joining step by step, with a dendrogram) and k-means (a fixed number of groups). Cluster analyses always find groups, even in random data; whether they make sense is a question of the subject.
What the table looks like
One row per case, at least two columns with numbers (at most 30). Cases with missing values in one of the features are not included; the number is shown in the result. Statable calculates on z-standardized values so that a feature with large numbers (hours) does not decide alone. This is a decision of the subject and can be switched off if all features have the same unit.
The number of groups
- The elbow plot shows the spread within the groups for each number of groups; where the curve bends, another group adds little.
- The silhouette measures how well each case fits its group (−1 to 1). Above .50 points to reasonable groups, above .25 to weak ones, below that hardly any structure can be seen. Statable names the number with the largest silhouette as a hint; the person decides.
Reading the result
- The profiles show, for each group, the mean of each feature and the deviation from the overall mean in standard deviations. η² says how much of the spread of a feature the groups explain; it only describes.
- There are no p values for the differences between the groups: the groups were formed so that the features differ; a test only seemingly "confirms" this.
- For k-means the result shows in how many of the 25 starts the best solution was found. With fewer than 10 the solution is not unique; then repeat with a different seed. Statable uses 25 starts and keeps the solution with the smallest spread; SPSS uses one start and can stop at a worse solution. Statable also works with z values, SPSS with raw values. So groups and their sizes can differ.
- For Ward the height of each merge is shown (as in R), not the cumulative coefficient from SPSS. The assignment of the cases is the same.
Requirements and limits
- Outliers easily form a group of their own; Statable points out values above 3.5 standard deviations and removes nothing. Very closely related features count twice.
- At least 10 cases and 3 per group; below 30 cases the groups are unstable. Ward works up to 3,000 cases, k-means up to 100,000. Text or categories as features do not work (they need the Gower distance).
- Saving the groups as a new column is possible only on request. These groups should not be used to test whether they differ.
Reporting the result
Ward's method (ward.D2, Euclidean, z-standardized), 3 groups (n = 43, 39, 36); mean silhouette = .41
For specialists
R 4.6 (stats): hclust(dist(Z), "ward.D2") with the height √(2·ΔESS) (Murtagh & Legendre 2014); kmeans with Hartigan-Wong, iter.max = 100, 25 starts from distinct cases, seed 20261008, Lloyd on abort. Groups are numbered by size so that the numbers stay the same when the seed changes. Silhouette (Rousseeuw 1987) and η² in JavaScript, checked against cluster::silhouette.
Typical examples
- Divide students by motivation, anxiety, study hours and self-efficacy into learning groups.
- Sort schools into similar groups by several indicators.