Re: [R] Elbow criterion plots for determining k in hierarchical clustering

From: Guera <>
Date: Fri, 14 Mar 2008 10:08:26 -0700 (PDT)

re:" ... (I) would like to create a plot to examine for the classic elbow criterion to use in determining the best number of clusters. Ideally I'd like to plot percent variance explained (y axis) against number of clusters (x axis).... Is there a way to do this in R...?"

I found a way to produce an elbow criterion plot, using height as a measure of dissimilarity. I determined the difference in height between the two most similar clusters at k=x from the dendrogram and plotted this (y) against k (x). It does produce an elbow in the plot which narrows it down considerably, but it is still subject to interpretation.

I chose k based on:
1. the location of the elbow on the plot 2. cluster size (e.g. if I had it narrowed down to 4 or 5, and making the fifth produced clusters of say 1 or 2 that weren't there at k=4, I'd use 4) 3. the height of the "tallest" cluster at k=x 4. the eigenvalues from a PCA at k=x.

I thought I should reply to my own post since I noticed that the other postings on similar topics also we're replied to, and thought this could possible help others down the road.

Rebecca Jeppesen, MSc Candidate
Acadia University
Wolfville, N.S.
View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 14 Mar 2008 - 17:12:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 14 Mar 2008 - 17:30:21 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive