# How to interpret agglomerative coefficient agnes() function?

how to interpret agglomerative coefficient in agnes() function of cluster package?

Example:

res.agnes <- agnes(dataset,method = 'ward')
res.agnes$ac 0.934  • how you said that distance is 20! – user47793 Mar 14 '18 at 10:30 ## 1 Answer Not sure if you are facing a concrete problem. Anyway, here it goes a definition of the agglomerative coefficient, from Finding Groups in Data: An Introduction to Cluster Analysis: Generally speaking, the AC describes the strength of the clustering structure that has been obtained by group average linkage. However, the AC tends to become larger when n increases, so it should not be used to compare data sets of very different sizes. Also, if you are familiar with the silhouette, The AC can also be compared to the silhouette coefficient (SC) First sight, the coefficient you get points to a pretty reasonable cluster structure in your data, since it is closed to 1: the coefficient takes values from 0 to 1, and it is actually the mean of the normalised lengths at which the clusters are formed. That is, the lengths you see when you look at your dendogram. EDIT after comments: indeed it can be misleading that the text in the book I referenced ("Finding Groups in Data...") refers in my copy-paste to the group average linkage. However, the coefficient refers to the banner (which is like a kind of simpler or binary dendogram) and just validates the structure that the clustering produces, regardless of the method. This is another reference to the agglomerative coefficient with no reference to the method used (although of course always in the context of hierarchical clustering). EDIT 2 after comments: I explain below my understanding on how the coefficient is calculated, always using the same reference. The formula for the coefficient is $$AC = \frac{1}{n} \sum_{i} l(i)$$ i.e. the mean of the l(i), calculated as follows: For each object i, we look at the line containing its label and measure its length I(i) on the 0-1 scale above or below the banner. Although I could not make the plot with 0-1 scale, it is just a normalization of the lengths. The banner is a binary representation of the dendogram, where: • in the left side, when all objects are separated in the initial stage of the agglomerative algorithm, the banner is just blank • as soon as 2 objects get together in the same cluster, they appear in the banner • the l(i) are marked by the points in the x axis in which the objects get together, and are the lengths of the horizontal bars of the plots Always clearer with an example, actually taken to a similar one in the same book. Let's imagine 5 objects in a space of 4 dimensions; 4 of the objects very closed together, and one of them far away. df <- data.frame("c1"=c(2, 2, 2, 2, 10), "c2"=c(2, 2, 2, 2, 10), "c3"=c(2, 2, 2, 2, 10), "c4"=c(2, 2, 2, 2, 10))  Let's do the clustering, library(cluster) r <- agnes(df, method="ward")  The bannerplot actually looks a bit ugly: but anyway, in there the 4 objects that are at the same position are joined at the beginning in a cluster, and the 5th is at distance 20. Personally, it is much easier to look at the dendogram: however the information is pretty much the same. Now the AC calculation. The lengths of the bars are 1 (normalized) for the first 4 objects, and 0 for the last one, thus the AC is 0.8: > r$ac
 0.8


In the dendogram, one should imagine the bars rotated 90 degrees, and they go from the root of the tree to the point in which the groups are formed.

• But he used ward, not group average linkage. – Has QUIT--Anony-Mousse May 11 '17 at 6:39
• @Anony-Mousse edited my answer. If you disagree please let me know. Thanks. – lrnzcig May 11 '17 at 15:10
• The book says "AC is the average width of the banner", which appears to be a kind of average (and normalized to 0:1) height of the dendrogram, but the actual way it is computed is unclear to me. – Has QUIT--Anony-Mousse May 11 '17 at 15:42