Computes the Adjusted Rand Index (ARI) from a contingency table. The ARI measures the similarity between two clusterings, adjusted for chance. Values range from -1 to 1, where 1 indicates perfect agreement, 0 indicates random agreement, and negative values indicate less agreement than expected by chance.
Details
The Adjusted Rand Index is calculated as: $$ARI = \frac{Index - Expected}{MaxIndex - Expected}$$
where Index is the sum of \(\binom{n_{ij}}{2}\) over all cells, Expected is derived from the row and column marginals, and MaxIndex is the average of row and column sum contributions. The values \(n_{ij}\) are from the contingency table, \(a_i\) are row sums, \(b_j\) are column sums, and \(n\) is the total number of isolates.