Theory, Examples & Exercises
This is an old revision of the document!
Evaluates, if the sample has appropriate group membership. Samples with high s value are well clustered, s value around zero means that the sample is between two clusters, and negative s value means that the sample has been misclassified.
For example, we will use results of beta flexible numerical classification of
vltava.spe data (see
agnes (library cluster)):
## Example of silhouette function ## Following code is not necessary, if you already used examples above... # library (cluster) # dis <- vegdist (sqrt (vltava.spe), method = 'bray') # percentage cover data are transformed by square root # cluster.flexible <- agnes (x = dis, method = 'flexible', par.method = 0.625) # cluster.flexible.hclust <- as.hclust (cluster.flexible) cl <- cutree (cluster.flexible.hclust, k = 5) si <- silhouette (cl, dis) plot (si) # Group 3 has the highest number of missclassified samples, on the other hand groups 1, 2 and 5 are well defined.
# Comparison of silhouettes for single linkage, complete average linkage method. # dis <- vegdist (sqrt (vltava.spe), method = 'bray') # percentage cover data are transformed by square root # cluster.single <- hclust (d = dis, method = 'single') # cluster.complete <- hclust (dis, 'complete') # cluster.average <- hclust (dis, 'average') par (mfrow = c(1,3)) plot (silhouette (cutree (cluster.single, k = 5), dis)) plot (silhouette (cutree (cluster.complete, k = 5), dis)) plot (silhouette (cutree (cluster.average, k = 5), dis))