# K-Means Clustering variable results depending on sort order of data

I'm using PASWStatistics18 and K-Means clustering data that I'd previously clustered using an earlier version of SPSS... My problem is that I'm getting different cluster results depending on how the data file is sorted. I can't remember this being an issue in the earlier versions of SPSS, but I can't repeat the same results, using the same data file, again! Only by using the saved cluster centres can I get close to the original result.

Have others had similar isues? Am I doing something wrong?

-
I don't know about PASWStatistics18 but it seems like either the initialisation of the first k centers is different for each run, or a mean is immediately updated after each datapoint (or some datapoints) assignation (like for the online k-means) . –  shn Mar 5 '12 at 9:13

Actually SPSS has acknowledged, going back at least to version 13 (ca. 2003) that cluster solutions will be affected by sort order. This applies not only to K-means but to its other clustering algorithms as well. You'll find this information in the Help files and possibly in the Tutorial. When using cluster analysis in SPSS I always create a random number and sort by that first.

-
can you give link to current help file? –  Atilla Ozgur Mar 5 '12 at 6:45
Hierarchical clustering doesn't depend on case order unless there are ties in the diatance matrix. –  ttnphns Mar 5 '12 at 7:21
DBSCAN is mostly order independent. Only for fringe points that could belong two two different clusters, the cluster assignment is not stable (unless you extend DBSCAN to support multi-assignments or use some other stable tie-braking rule).