0
$\begingroup$

I am trying to use some R packages such as "stats" and "fpc" to calculate cophenetic correlation coefficient (like the method here) and some internal validations of my hierarchical clustering result(like the method using cluster.stats() mentioned here)

But as my weighted graph is disconnected (has several separate components of nodes), some nodes are unreachable by the others and their distances are infinite (Inf). The distance matrix looks pretty much like this.

The R packages I found so far seems can't deal with Inf in the distance matrix. But then if I remove Inf, the length of the distance matrix and my clustering result won't match, and I can't replace Inf with zero in this case either.

I found out that when R package"igraph" calculate closeness (sum of distances) of a disconnected graph, it would replace Inf with the number of vertices in the network. I wonder can I apply this method to my distance matrix? (ex: My graph has 95 nodes so I replace all the Inf with 95 in the matrix.)

Or is there any other way? Maybe I should focus on each component one time instead of the whole graph?(But since one of my graphs is very disconnected, I'm not sure this is a good idea).

$\endgroup$
0
$\begingroup$

The cophenetic distance of disconnected components is infinite.

So it's not the fault of the R packages...

I don't think substituting a large constant will do the trick, if you want to compute correlation later on, as large values will have much more effect on the correlation. So results will look good simply because they preserve disconnected components (which they most likely will).

You could try using rank correlation, I.e. spearman.

$\endgroup$
  • $\begingroup$ Thanks! I will look into rank correlation. Yes, I understand that it's not R packages' fault...but I'm at a lost on how to do with disconnected graphs. And do you have any idea about calculating internal validations? Will simply comparing the validation results of the largest component in the graph works? $\endgroup$ – WhiteLin Jul 4 '17 at 5:17

Your Answer

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

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