# Am I right that Calinski-Harabasz index (Pseudo-F) can not be calculated from a distance matrix other than euclidean?

1. Part: I wonder if one could calculate the Calinski-Harabasz index when only having a distance matrix (and a cluster solution, of course). As you need the within and between sum of squares to come up with this so called Pseudo-F index, you also need some sort of (continous) raw data, right?

2. Part: Except that you have a distance matrix that you can be sure contains euclidean distances. You could than come up with the within and between sum of squares based on those euclidean distances, right?

Am I mistaken?

Context: I am working with sequence data at the moment, and there are several ways to prepare them for clustering (I am not bothering you with the details here). One way is to directly come up with some distance metrics based on some global similarities/properties of the sequences - and they are all non-euclidean. If you are interested: here you are.

• Computing them on a distance matrix is O(n²), but usually you would use an O(n) approach to compute them using the total variance and the cluster variances. – Has QUIT--Anony-Mousse Aug 24 '19 at 6:28
• Thanks for you comment. My question is more about the theoretical feasibility and whether I'm right that it can only be done with euclidean distances. But I think that is answered. Thank you very much. – MLud Aug 24 '19 at 6:40
• If the slow runtime isn't a problem for you, then you can also use Silhouette, which works with non-Euclidean data. – Has QUIT--Anony-Mousse Aug 24 '19 at 6:44

## 1 Answer

1. Calinski-Harabasz criterion and similar clustering indices based on ANOVA terms SSbetween, SSwithin, SStotal, can still be computed from the distance matrix between the objects, albeit computing them from objects x features dataset are simplier. Here is how to do it. Besides, you can always turn a distance matrix into a objects x features dataset by means of Multidimensional Scaling (MDS).

2. From the euclidean geometry p.o.w. (and, mind, things like means, squared deviations from means etc. are based - meaninfully like in ANOVA - on Euclidean space) the only correct would be to use (squared) euclidean distance matrix. Other metric but not euclidean distances could be used heuristically, but geometrically that isn't quite right.

Please visit my web page and download/read a description doc. about "Internal clustering criteria".

If your initial data are dissimilarities which are far not euclidean and probably non-metric, yet you insist to use measures like Calinski-Harabasz after clustering, I would recommend to do MDS to embed the dissimilarities in euclidean space, and then process the objects x dimensions dataset the usual way.

• So, if I understood you correctly, you are also saying that one can only come up with the SSb, SSw, SSt (your 1.) when having access to (squared) euclidean distances (my 2), right? – MLud Aug 23 '19 at 18:23
• Ah, saw you edit just now. Thanks for clarifying and your answer! – MLud Aug 23 '19 at 18:25
• Yes, you must have euclidean distances to correctly assess these quantities. – ttnphns Aug 23 '19 at 18:26