2
$\begingroup$

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

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


pvclust

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

enter image description here

$\endgroup$

closed as off-topic by gung, Michael Chernick, mpiktas, John, kjetil b halvorsen May 16 '17 at 22:46

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – gung, Michael Chernick, mpiktas, John, kjetil b halvorsen
If this question can be reworded to fit the rules in the help center, please edit the question.

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

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.

$\endgroup$
  • $\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$ – geekoverdose Feb 7 '18 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 Mar 7 '18 at 2:28

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