I am using kmeans() to cluster standardized scores from a factor analysis in R (20 variables, 919 cases).

As R uses random cases for the initial centroids, I was hoping that choosing a high value for $nstart$, such as 25 or 50 would help stabilize the solution.

However, this frequently (many combinations/ runs of 6 or 7 clusters and $nstart > 10$) results in a cluster with $n = 1$.

  • What could be the reason for this and how should I deal with it?
  • Is stabilizing the solution through a higher nstart generally a good idea?

2 Answers 2


Mechanistically, you can use R to help identify the appropriate number of clusters:

wssplot <- function(data, nc=15, seed=1234){
               wss <- (nrow(data)-1)*sum(apply(data,2,var))
               for (i in 2:nc){
                    wss[i] <- sum(kmeans(data, centers=i)$withinss)}
                plot(1:nc, wss, type="b", xlab="Number of Clusters",
                     ylab="Within groups sum of squares")}



nc <- NbClust(df, min.nc=2, max.nc=15, method="kmeans")

This R in Action link provides more details, but it is recommended to use >25 initial configurations.

Reasons for the single cluster would either be that you're only selecting one to start or that the data don't separate very well.

  • $\begingroup$ Thanks for this, but I don't think this answers my question. I decided on number of clusters (6) based on such a plot as your wssplot. However, the problem is that nstart>25 results in one of the 6 clusters only containing one case/ respondent. Sorry if this was unclear. $\endgroup$
    – Marianne
    Commented Dec 1, 2015 at 12:16

As @Minnow suggests, it sounds like that case is an outlier. It's possible that that case is so different from the others that the algorithm thinks it belongs in it's own cluster. Looking over your data, you may find that one of the variables you're plugging into the algorithm could be a major driver of that, so you could either exclude that variable, or possibly exclude the entire case to see how clustering occurs after that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.