# Cophenetic distance matrix to a dendrogram

In hierarchical clustering procedure, a distance matrix is used to construct a dendrogram with an appropriate method of clustering. In the process of constructing a dendrogram, a cophenetic matrix is computed. I understand that such a cophenetic matrix is used to assess clustering consistency.

How can I use a cophenetic matrix as such to plot the dendrogram?

• A cophenetic matrix would be a distance matrix wherein original pairwise distances between the objects are replaced by the computed distances between their clusters at the time of these clusters' merge. Now, most hierarchical clustering programs do not construct such a matrix (no need for) and they plot dendrogram out of another source (such as agglomeration history protocol). – ttnphns Jun 20 '14 at 6:22
• P.S. You surely can use that matrix to build the dendrogram, but it is cumbersome to do because a step number is not written there! – ttnphns Jun 20 '14 at 6:27
• @ttnphns what do you mean by step number? Is it height or the merge groups? – Crops Jun 20 '14 at 6:49
• I have a cophenetic matrix derived from an iterative ordering method of clustering. I would like to use that for plotting a dendrogram. – Crops Jun 20 '14 at 6:51
• Step number - step of agglomeration in hierarchical clustering. Ordinal number of bars (not branches) on dendrogram. – ttnphns Jun 20 '14 at 7:10

You can just recreate the plot using hclust on the cophenetic of the object, and it would get you what you want (the method used in hclust doesn't matter).

set.seed(2015-04-26)
dat <- (matrix(rnorm(100), 4, 24))
dat_dist <- dist(dat)
hc1 <- hclust(dat_dist)

dat_dist

hc2 <- hclust(cophenetic(hc1), method = "complete")
hc3 <- hclust(cophenetic(hc1), method = "single")
hc4 <- hclust(cophenetic(hc1), method = "ave")

par(mfrow = c(1,4))
plot(hc1)
plot(hc2)
plot(hc3)
plot(hc4) 