看看this page:
我也有类似的问题问here
我们似乎可以用表象相关测量两个树形图之间的相似性。但是目前在R中似乎没有这个功能。
EDIT在2014,9,18: 在stats
包的cophenetic
功能是能够计算同表象相异矩阵。并且可以使用cor
函数来计算相关性。因为@Tal指出as.dendrogram
函数以不同的顺序返回树,如果我们根据树状图结果计算相关性,这将导致错误的结果。作为dendextend
包装表现出功能cor_cophenetic
功能的例子:
set.seed(23235)
ss <- sample(1:150, 10)
hc1 <- iris[ss,-5] %>% dist %>% hclust("com")
hc2 <- iris[ss,-5] %>% dist %>% hclust("single")
dend1 <- as.dendrogram(hc1)
dend2 <- as.dendrogram(hc2)
# cutree(dend1)
cophenetic(hc1)
cophenetic(hc2)
# notice how the dist matrix for the dendrograms have different orders:
cophenetic(dend1)
cophenetic(dend2)
cor(cophenetic(hc1), cophenetic(hc2)) # 0.874
cor(cophenetic(dend1), cophenetic(dend2)) # 0.16
# the difference is becasue the order of the distance table in the case of
# stats:::cophenetic.dendrogram will change between dendrograms!
::查找树状图::现在你有我好奇。这种比较首先有什么指标? – dmckee 2010-02-07 21:41:18
您确定要这么做吗?树状图只是数据的表示。我认为比较(直接)在这两个树状图中划分的数据将会提供更多信息。 – doug 2010-02-16 18:51:56