0

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

dcarlson
  • 10,936
  • 2
  • 15
  • 18
Eve
  • 1
  • Welcome to Stackoverflow! Please provide a reproducible code example, markup code as code and - where helpful - add images that explain what you exactly want to achieve. – Markus May 20 '22 at 16:19
  • You read your data in as HWI and then you used `dist(HWI, method="euclidean")` to compute Euclidean distances between pairs of rows in the original data. Then you clustered based on those distances and obtained a dendrogram based on those distances. Perhaps your original data consist of an association matrix? If so, you probably want to cluster it directly. – dcarlson May 21 '22 at 02:45

0 Answers0