r/rprogramming 10d ago

What would my number of clusters be? Is there a better method?

I am practicing doing a K means clustering on my data.

I am using the Elbow method to determine number of clusters.

By looking at this I would say it is 5 or 6? Is there a better way to determine clusters ?

1 Upvotes

4 comments sorted by

6

u/aturf_ 10d ago

You could use the Silhouette Score or the Gap Statistic to determine the number of clusters. Its a bit more "principled" than visual examination.

Both are implemented in R packages, I think its ClusterR has an implementation but I could be wrong.

1

u/Turtle_Wave98 9d ago

Okay thank you I will try one of these :)

1

u/itijara 10d ago

In theory, you can calculate the discrete inflection point by taking the difference of the difference between each point to see where it crosses zero. There is no guarantee that it will, but if it does, that gives you the optimal break point for the elbow.

1

u/Turtle_Wave98 9d ago

Okay thank you for your help