# Why hierarchical clustering with pvclust and hclust gives different results? [closed]

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.

# hclust

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


# pvclust

######### 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)
library(pvclust)
result = pvclust(sd.data0, method.hclust="average", method.dist="correlation",
nboot=100, r=seq(0.7,1.4,by=.1))
plot(result)


• They are two different methods so what makes you think they will return the same answers?
– Dan
Commented Aug 27, 2014 at 16:46
• @Dan,Because the pvclust mentioned they used the same method as hclust Commented Aug 27, 2014 at 20:09
• Can you give the whole data (and in text, please)? How can one check without the data? Commented Aug 28, 2014 at 6:06
• 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. Commented Aug 31, 2014 at 10:29

• 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. Commented Feb 7, 2018 at 12:51
• @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!