As it is obvious from the dendrograms and the graphs of the fusion levels, the four
analyses tell different stories.
Now, if you want to set a common number of groups and compare the group
contents among dendrograms, you can use the cutree() function and compute
contingency tables:
# Choose a common number of groups
k <- 4 # Number of groups where at least a small jump is present
# in all four graphs of fusion levels
# Cut the dendrograms and create membership vectors
spech.single.g <- cutree(spe.ch.single, k = k)
spech.complete.g <- cutree(spe.ch.complete, k = k)
spech.UPGMA.g <- cutree(spe.ch.UPGMA, k = k)
spech.ward.g <- cutree(spe.ch.ward, k = k)
spech.beta.g <- cutree(spe.ch.beta2, k = k)
# Compare classifications by constructing contingency tables
# Single vs complete linkage
table(spech.single.g, spech.complete.g)
# Single linkage vs UPGMA
table(spech.single.g, spech.UPGMA.g)
# Single linkage vs Ward
table(spech.single.g, spech.ward.g)
# Complete linkage vs UPGMA
table(spech.complete.g, spech.UPGMA.g)
# Complete linkage vs Ward
table(spech.complete.g, spech.ward.g)
# UPGMA vs Ward
table(spech.UPGMA.g, spech.ward.g)
# beta-flexible vs Ward
table(spech.beta.g, spech.ward.g)
If two classifications had provided the same group contents, the contingency
tables would have shown only one non-zero frequency value in each row and each
column. This was almost never the case here. For instance, the 26 sites of the
second group of the single linkage clustering are distributed over the four groups
of the Ward clustering.
However, one of the tables created above shows that two classifications resemble
each other quite closely. Which ones?
4.7.3.2 Compare Two Dendrograms to Highlight Common Subtrees
To help select a partition found by several algorithms, it is useful to compare
dendrograms and seek common clusters. The tangelgram() function from the
dendextend package does this job nicely. Here we compare the dendrograms
4.7 Interpreting and Comparing Hierarchical Clustering Results
77
analyses tell different stories.
Now, if you want to set a common number of groups and compare the group
contents among dendrograms, you can use the cutree() function and compute
contingency tables:
# Choose a common number of groups
k <- 4 # Number of groups where at least a small jump is present
# in all four graphs of fusion levels
# Cut the dendrograms and create membership vectors
spech.single.g <- cutree(spe.ch.single, k = k)
spech.complete.g <- cutree(spe.ch.complete, k = k)
spech.UPGMA.g <- cutree(spe.ch.UPGMA, k = k)
spech.ward.g <- cutree(spe.ch.ward, k = k)
spech.beta.g <- cutree(spe.ch.beta2, k = k)
# Compare classifications by constructing contingency tables
# Single vs complete linkage
table(spech.single.g, spech.complete.g)
# Single linkage vs UPGMA
table(spech.single.g, spech.UPGMA.g)
# Single linkage vs Ward
table(spech.single.g, spech.ward.g)
# Complete linkage vs UPGMA
table(spech.complete.g, spech.UPGMA.g)
# Complete linkage vs Ward
table(spech.complete.g, spech.ward.g)
# UPGMA vs Ward
table(spech.UPGMA.g, spech.ward.g)
# beta-flexible vs Ward
table(spech.beta.g, spech.ward.g)
If two classifications had provided the same group contents, the contingency
tables would have shown only one non-zero frequency value in each row and each
column. This was almost never the case here. For instance, the 26 sites of the
second group of the single linkage clustering are distributed over the four groups
of the Ward clustering.
However, one of the tables created above shows that two classifications resemble
each other quite closely. Which ones?
4.7.3.2 Compare Two Dendrograms to Highlight Common Subtrees
To help select a partition found by several algorithms, it is useful to compare
dendrograms and seek common clusters. The tangelgram() function from the
dendextend package does this job nicely. Here we compare the dendrograms
4.7 Interpreting and Comparing Hierarchical Clustering Results
77
