了解R中的热图树状图聚类 [英] Understanding heatmap dendogram clustering in R

查看:451
本文介绍了了解R中的热图树状图聚类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会很高兴R的热图功能的树状图(Colv,Rowv)上的任何信息材料。例如聚类的工作原理(是欧几里德距离吗?)。您不必发表冗长的解释,我会对某些可以使我走上正确道路的关键字感到满意,因此我可以进行一些在线研究。

I would appreciate any info material on the dendograms (Colv, Rowv) of R's heatmap function. Such as how the clustering works (is it euclidean distance?). You don't have to post lengthy explanations, I would already be happy about some keywords that could bring me on the right track so I could do some online research.

这里是帮助手册的摘录,这使我有些困惑。在这种情况下,尊敬是什么意思,它与重新排序有什么不同?

Here is an excerpt from the help manual, which confuses me a little bit. What does "honored" mean in this context and how is it different from reordering?


如果Rowv或Colv是树状图,则将它们尊敬(而不是重新排序
)。

If either Rowv or Colv are dendrograms they are honored (and not reordered).


推荐答案

Rowv Colv 控制是否应对数据集的行和列进行重新排序,以及是否应重新排序。

Rowv and Colv control whether the rows and columns of your data set should be reordered and if so how.

它们的可能值为 TRUE NULL FALSE ,整数向量或树状图对象。

The possible values for them are TRUE, NULL, FALSE, a vector of integers, or a dendrogram object.


  • 在默认模式下 TRUE ,heatmap.2使用 hclustfun distfun 参数执行聚类。默认使用欧几里德距离度量来完成链接聚类。然后使用行/列方式对树状图进行重新排序。您可以通过为 hclustfun distfun 指定不同的函数来控制它。例如,要使用曼哈顿距离而不是欧式距离,就可以做到:

  • In the default mode TRUE, heatmap.2 performs clustering using the hclustfun and distfun parameters. This defaults to complete linkage clustering, using a euclidean distance measure. The dendrogram is then reordered using the row/column means. You can control this by specifying different functions to hclustfun or distfun. For example to use the Manhattan distance rather than the euclidiean distance you would do:

heatmap.2(x,...,distfun=function (y) dist(y,method = "manhattan") )

结帐?dist ?hclust 。如果您想了解有关聚类的更多信息,可以从距离度量和聚结方法开始。

check out ?dist and ?hclust. If you want to learn more about clustering you could start with "distance measures" and "agglomeration methods".

如果 Rowv / Colv NULL FALSE 则不进行任何重新排序或聚类,并且按原样绘制矩阵。

If Rowv/Colv is NULL or FALSE then no reordering or clustering is done and the matrix is plotted as-is.

如果 Rowv / Colv 是一个数字向量,然后按照 TRUE 计算聚类,并使用提供给 Rowv / Colv

If Rowv/Colv is a numeric vector, then the clustering is computed as for TRUE and the reordering of the dendrogram is done using the vector supplied to Rowv/Colv.

如果 Rowv / Colv 是一个树状图对象,然后将使用该树状图对矩阵重新排序。可以通过以下方式生成树状图对象:

If Rowv/Colv is a dendrogram object, then this dendrogram will be used to reorder the matrix. Dendrogram objects can be generated, for example, by:

rowDistance = dist(x, method = "manhattan")
rowCluster = hclust(rowDistance, method = "complete")
rowDend = as.dendrogram(rowCluster)
rowDend = reorder(rowDend, rowMeans(x))

会在曼哈顿距离上生成完整的聚类,按行均值排序。现在,您可以将 rowDend 传递给 Rowv

which generates a complete clustering on a manhattan distance, ordered by row means. You can now pass rowDend to Rowv.

heatmap.2(x,...,Rowv = rowDend)

这很有用,例如,如果您想以不同的方式对行和列进行聚类,或者使用其他人给您的聚类,或者想要做一些仅通过指定hclustfun和distfun无法容纳的时髦的事情。这就是树状图被纪念的意思:它被使用,而不是hclustfun和distfun指定的东西。

This can be useful, if for example you want to cluster the rows and columns in different ways, or use a clustering that someone else has given you, or you want to do something funky that cannot be accommodated by just specifying the hclustfun and the distfun. This is what is meant by" the dendrogram is honoured": it is used instead of what is specified by hclustfun and distfun.

这篇关于了解R中的热图树状图聚类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆