Hi There, I'm working on some cluster analyses on a large data-set using hclust with Wards method and Manhattan (city block) distance measures. I've created dendrograms to illustrate the clustering criteria, but 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 base or cluster packages that I'm missing? As an alternative I've attempted to write a function for the purpose, but am unable to find a way to determine the within group variance for each cluster and total variance (needed to compute variance explained). I'm new to R in the last month or so and greatly appreciate any advice you can give me. I've included my code for a subset of the data below (in which k=4 as an example) Thanks in advance, Becky > HClf_dn <- hclust(dist(model.matrix(~-1 + f_dn1+f_dn2+f_dn3+f_dn4, > CwdDbh), method= "manhattan") , method= "ward") > plot(HClf_dn, main= "Cluster Dendrogram for Solution HClf_dn", xlab= > "Observation Number in Data Set CwdDbh", sub="Method=ward; > Distance=city-block") > summary(as.factor(cutree(HClf_dn, k = 4))) # Cluster Sizes > by(model.matrix(~-1 + f_dn1 + f_dn2 + f_dn3 + f_dn4, CwdDbh), > as.factor(cutree(HClf_dn, k = 4)), mean) # Cluster Centroids > biplot(princomp(model.matrix(~-1 + f_dn1 + f_dn2 + f_dn3 + f_dn4, > CwdDbh)), xlabs = as.character(cutree(HClf_dn, k = 4))) ----- Rebecca Jeppesen, MSc Candidate Acadia University Wolfville, N.S. Canada -- View this message in context: http://www.nabble.com/Elbow-criterion-plots-for-determining-k-in-hierarchical-clustering-tp15921695p15921695.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.