I thought this was going to be trivial, but it seems I was wrong.

I have 2 datasets which are metrics of dendrogram congruence. I currently have them formatted as matrices as I have made heatmaps from them. What I want to do is get the correlation between the various metrics I'm comparing, do determine how robust the metrics are for each tree comparison.

The problem is, the metrics score 'in opposite directions'. By which I mean, a score of 1 in the Adjusted Wallace Coefficient shows good congruence, however a score of 1 in the Normalised Robinson-Foulds metric, shows the opposite. How should I correlate each cell of these matrices, given that a 0 in one and a 1 in the other demonstrate the same thing?

My initial thoughts were to reciprocate the values of one of the matrices, but this doesn't help with the 0 or 1 diagonal, and/or take the magnitude of the correlation since I'm not concerned with negative/positivie correlation - but also doesn't solve the diagonal. Am I just going to have to brute force the diagonal to a 0 or 1 in both matrices?

Each matrix is actually 17x17, but here's the first 5x5 of each for sample data.

The Robinson-Foulds Data (tab separated):

        Tree01  Tree02  Tree03  Tree04  Tree05
Tree01  0   0.538461538 0.5 0.307692308 0.538461538 
Tree02  0.538461538 0   0.8 0.538461538 0.692307692 
Tree03  0.5 0.8 0   0.5 0.7 
Tree04  0.307692308 0.538461538 0.5 0   0.461538462 
Tree05  0.538461538 0.692307692 0.7 0.461538462 0

The Adjusted-Wallace Data (tab separated):

        Tree01  Tree02  Tree03  Tree04  Tree05  
 Tree01 1.000   0.722   0.455   1.000   0.722
 Tree02 0.722   1.000   0.364   1.000   0.630
 Tree03 0.556   0.444   1.00    0.543   0.222
 Tree04 0.778   0.778   0.345   1.000   0.630
 Tree05 0.722   0.630   0.182   0.810   1.000

If I correlate them at the minute, I get the following, where the diagonal has an (understandably) crappy correlation


     Tree01 Tree02  Tree03  Tree04  Tree05  
Tree01  -0.550101650994689  -0.159285982502163  -0.00257133117882069    -0.280890744724045  -0.0474274308624492
Tree02  0.174854748575982   -0.506354917963404  0.534837867193614   0.0411304385572965  0.184541155488869
Tree03  -0.198112273907698  0.176533579485163   -0.847657437346223  0.0259972403170784  0.447859497524351
Tree04  -0.265005920183336  -0.43750308586023   0.446985741314752   -0.299704439501887  -0.11335268631684
Tree05  -0.00139951355166384    -0.033184120012331  0.599283023791696   -0.0087100425318683 -0.574671904065799
  • $\begingroup$ I don't understand the issue. Since for most metrics the diagonals are predetermined--they provide no information whatsoever--why are you even including them in your calculation? $\endgroup$ – whuber Jan 24 '17 at 16:40
  • $\begingroup$ I've been keeping them for the purposes of producing the heatmaps - kind of like a control, just to satisfy myself they are plotting correctly etc. I could NA them out for this I suppose. That still only partially solves the problem though, waht would you suggest is the best way to correlate the remaining values, just like I have, and then take the absolute value? $\endgroup$ – Joe Healey Jan 24 '17 at 16:48
  • $\begingroup$ Why does it only partially solve the problem? Does something go wrong? $\endgroup$ – whuber Jan 24 '17 at 16:49
  • $\begingroup$ Assuming you do want the correlation between these matrices, can't you just do cor(AWData, 1-RFData)? $\endgroup$ – combo Jan 24 '17 at 16:49
  • $\begingroup$ I mean the diagonal was only part of the question, the larger question is what is the best way to actually do it? for example, should I just take the magnitude after the fact or can I pass something to cor? $\endgroup$ – Joe Healey Jan 24 '17 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.