1
$\begingroup$

By comparing the dendrograms produced by the clustergram object and the "manual" approach i.e. pdist -> linkage -> dendrogram I found they are different, but cannot find an explanation for that difference.

Clustergram documentation says that the default distance used is 'Euclidean' and the default linkage method is 'Average', same parameters I used for pdist and linkage functions.

I thought it might be related to the standardization performed by clustergram, so I used z-score for standardizing first my matrix and then each column separately, but the dendrograms are still different as compared with the one produced by clustergram.

Can somebody explain the reason behind that difference, and how can I use the "manual" approach for getting the same dendrogram?

Many thanks in advance.

Edit: I compared the results obtained by the "manual" approach with the SPSS results and they are the same.
Also, I tested all different ' data processing' options with clustergram but the dendrogram keeps being different.

$\endgroup$

1 Answer 1

1
$\begingroup$

pdist -> linkage -> dendrogram is also used in clustergram, just open the clustergram code:

dist = pdist(data, pdistArgs{:});
Z = linkage(dist, linkageArgs);

...

[lineH, T, Perm] = dendrogram(Z,0,dendroArgs{:},'Orientation', dendroLoc);

So the only difference can be in data preprocessing or parameters for pdist/linkage/dendrogram. I suggest you go over the clustergram parameters one by one. You can also look through the code although it is pretty long.

$\endgroup$
3
  • $\begingroup$ Yeap I print it out 40 pages!!! I'm studying it but honestly is my first time working with a Class in Matlab, so it's kind of messy for me to follow it. I found couple of things more that can make a difference like OptimalLeafOrder, Log2 Transform Data, and the Computation of the dendogram along both directions. However the only way I can imagine for evaluating this Class is by building it up step by step... and that seems to be a huge work... So any ideas are very much welcome. $\endgroup$
    – Diego
    Commented Oct 11, 2012 at 15:39
  • 1
    $\begingroup$ @Diego Make sure you are clustering only by rows/columns, not by both (default is by both). $\endgroup$
    – Bitwise
    Commented Oct 11, 2012 at 15:53
  • $\begingroup$ Yes, I've thought about that and performed some tests: c = clustergram(A,'Cluster','column'); and c = clustergram(A,'Cluster','all');. However both lines return the same "column" dendrogram and same heat map with different order in the heat map. $\endgroup$
    – Diego
    Commented Oct 11, 2012 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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