I am performing the hierarchical clustering analysis on a dataset of 25 viral populations using 3 viral components (variables) to construct a dendrogram with average method and correlation distance calculation. We firstly used the hclust() method generate a plot, but we still need to support the dendrogram by statistical analysis. So after transposing the data, we choose pvclust() to generate the dendrogramm. However, the plots constructed by pvclust and the one generated by hclust are totally different. We used the same data and same parameters (average method and correlation distance), but the results are so different. Why might this be? Here is the dataset.


enter image description here

######### hclust method #############
sd.data = scale(tav.data)
dd = as.dist(1-cor(t(sd.data)))  # correlation-based distance
plot(hclust(dd, method="average"), xlab="", sub="", 
     main="Average Linkage with Correlation-Based Distance", labels=tav.labs)

enter image description here


enter image description here

######### pvclust method ################
tav.data0 = tav.data[,c(1,2,3)]
rownames(tav.data0) <- tav.labs
tav.data0 = as.data.frame(t(tav.data0))
sd.data0 = scale(tav.data0)
result = pvclust(sd.data0, method.hclust="average", method.dist="correlation", 
                 nboot=100, r=seq(0.7,1.4,by=.1))

enter image description here

  • 4
    $\begingroup$ They are two different methods so what makes you think they will return the same answers? $\endgroup$
    – Dan
    Commented Aug 27, 2014 at 16:46
  • $\begingroup$ @Dan,Because the pvclust mentioned they used the same method as hclust $\endgroup$
    – user44425
    Commented Aug 27, 2014 at 20:09
  • $\begingroup$ Can you give the whole data (and in text, please)? How can one check without the data? $\endgroup$
    – ttnphns
    Commented Aug 28, 2014 at 6:06
  • $\begingroup$ I could reproduce your second dendrogram by clustering in SPSS, but failed to do it for your first dendrogram. You might be doing something wrong in your 1st case. Check if your first 2 statements there give you exactly the same distance matrix as the matrix in your second case. $\endgroup$
    – ttnphns
    Commented Aug 31, 2014 at 10:29

1 Answer 1


You said you transposed your data before using pvclust.

Using hclust() is 2 steps: first make a distance matrix with dist(), then feed that into hclust()

Using pvclust is 1 step: feed your data table directly into pvclust().

The format for dist() and pvclust() is the same, so you should not have transposed your data. Both ways you end up clustering columns according to rows.

  • $\begingroup$ No: hclust by default looks at rows of passed dataframes, pvclust by default looks at columns. Hence, without transposing, with pvclust you would get a dendrogram of features instead of samples, when hclust gives you a dendrogram of samples for the same input. As a result, and contrary to this answer, transposing would be correct - just in case anybody runs into this answer. $\endgroup$ Commented Feb 7, 2018 at 12:51
  • $\begingroup$ @geekoverdose I think the issue was that they should not have transposed before using dist. Has been a while, but takeaway from this comment remains: double check how rows and columns are changing in your workflow! $\endgroup$
    – rrr
    Commented Mar 7, 2018 at 2:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.