Eve
Eve

Reputation: 1

Plotting a dendrogram with actual data as 'height' of the tree, and not distances, in R

I want to generate a dendrogram out of an association matrix (i.e., a squared matrix that contains association data for each pair of individuals in my population). The dendrogram should show the association index (scale 0 to 1) on the y axis and individuals as leaf labels.

I did as follows:

#Loaded my data i.e., association matrix :
HWI<-as.matrix(read.csv2(HWI.csv))

#Computed distances:
data.dist=dist(HWI, method = "euclidean")

#Did the clustering using the 'average-linkage method':
data.hclust=hclust(data.dist,method="average")

#Plotted the dendrogram:
hcd <- as.dendrogram(data.hclust)
plot(hcd, type = "rectangle", xlab = "Associative distance between individuals",horiz = TRUE)

The problem is, the height of the dendrogram is the distance measure, on which the clustering is based, and not the association index.

Does anyone know how I can plot the dendrogram with the association index (original data file) as y-axis instead?

Thanks a million for your suggestions.

Eve

Upvotes: 0

Views: 174

Answers (0)

Related Questions