【问题标题】:Visualization of response variables in hierarchical clustering dendrogram plot层次聚类树状图中响应变量的可视化
【发布时间】:2019-06-24 22:29:45
【问题描述】:

我想在层次聚类树状图中表示响应变量“Sepal.Length”、“Sepal.Width”、“Petal.Length”和“Petal.Width”,但没有成功。我做:

#Example with iris data set
library(vegan)
data(iris)
names(iris)
# [1] "Sepal.Length" "Sepal.Width"  "Petal.Length" "Petal.Width"  "Species"  

y <- as.matrix(iris[,-5])[6*(1:25),]   # subsample to make the graphs
rownames(y) <- iris$Species[6*(1:25)]  # pretty

#Calculate distance matrix using Bray
comm.pat.dist <- vegdist(y, method = "bray")

#Create a cluter using hclust 
comm.bc.clust <- hclust(comm.pat.dist, method = "ward.D2")

# Plot cluster 
hpat <- as.dendrogram(comm.bc.clust)
nodePar <- list(lab.cex = 0.6, pch = c(NA, 19), 
                cex = 0.7, col = "blue")
plot(hpat, ylab = "Bray dissimilarity", 
nodePar = nodePar, cex=0.75, edgePar = list(col = 2:3, lwd = 2:1), horiz = TRUE)
#

现在我不知道在树状图的节点中代表变量“Sepal.Length”、“Sepal.Width”、“Petal.Length”和“Petal.Width”的代码有哪些变化。有没有会员可以帮帮我? 谢谢

【问题讨论】:

    标签: r cluster-analysis dendrogram vegan


    【解决方案1】:

    您无法表示变量。您有一个用于观察的相异矩阵(Bray-Curtis 是一个不充分的相异度量),原始变量的所有信息都将在相异中丢失。

    【讨论】:

    • 感谢Oksanen的解释
    猜你喜欢
    • 1970-01-01
    • 2021-10-04
    • 2014-12-14
    • 2020-06-30
    • 2014-12-23
    • 2016-01-31
    • 2018-11-26
    • 1970-01-01
    • 2014-10-03
    相关资源
    最近更新 更多