Search code examples
rcluster-analysisdendrogramvegan

Visualization of response variables in hierarchical clustering dendrogram plot


I've like to represent in hierarchical clustering dendrogram plot the response variables "Sepal.Length", "Sepal.Width", "Petal.Length"and "Petal.Width" without sucess. I make:

#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)
#

Dedrogarm plot

And now I don't know what kind of changes in code for represent in the nodes of dendrogram the variables "Sepal.Length", "Sepal.Width", "Petal.Length" and "Petal.Width". Any member could help me? Thanks


Solution

  • You can't represent the variables. You had a dissimilarity matrix for observations (and Bray-Curtis is an inadequate dissimilarity measure), and all information on original variables will be lost in dissimilarities.