[英]Visualization of response variables in hierarchical clustering dendrogram plot
我想在層次聚類樹狀圖中表示響應變量“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”的代碼有什么樣的變化。 有會員可以幫我嗎? 謝謝
你不能代表變量。 您有一個用於觀察的相異矩陣(而 Bray-Curtis 是一個不充分的相異度量),並且原始變量的所有信息都將因相異而丟失。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.