# 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. Aug 24, 2019 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, 2019 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. Aug 24, 2019 at 6:44

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.