compare.kappa: Comparison of two sets of clusters, using kappa

compare.kappaR Documentation

Comparison of two sets of clusters, using kappa

Description

Comparison of two sets of clusters, using kappa

Usage

compare.kappa(clus, gt, comp = c("max", "pairwise", "cluster"))

Arguments

clus

The extracted clusters.

gt

The real clusters.

comp

How the two partitions are compared. "max" matches each extracted cluster with the class it agrees with most and averages the per-cluster scores, weighted by cluster size; "cluster" returns those scores instead of averaging them; "pairwise" ignores the labels and looks at every pair of observations, asking whether the two partitions agree on grouping it or separating it. In "pairwise" mode this function is the Rand index: the proportion of pairs the two partitions agree on, counting both those they group and those they keep apart. See compare.jaccard and compare.kappa for the two other readings of the same pair counts.

Value

A numeric value indicating how much the two sets of clusters are similar.

The pairwise index

Cohen's kappa on the fourfold table of pair agreements, i.e. the Rand index of compare.accuracy corrected for the agreement expected by chance. That quantity is also the Hubert-Arabie adjusted Rand index – a theorem of Warrens (2008), not a substitution.

References

Warrens, M.J. (2008). On the Equivalence of Cohen's Kappa and the Hubert-Arabie Adjusted Rand Index. Journal of Classification, 25(2), 177-183.

See Also

compare.accuracy, compare.jaccard, compare

Examples

require (datasets)
data (iris)
km = KMEANS (iris [, -5], k = 3)
compare.kappa (km$cluster, iris [, 5])

fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.