R/cc_test_ari.R
cc_test_ari.Rd
A test for testing the null hypothesis of random agreement (i.e., adjusted Rand Index equal to 0) between two partitions.
cc_test_ari(ground_truth, partition)
(int) A vector of the actual membership of elements in clusters
The partition coming from a clustering algorithm
A list with six elements:
the Rand Index
expected value of Rand Index
Adjusted Rand Index
variance of Rand Index
nari
the p-value of the test
E_M. Qannari, p. Courcoux and Faye p. (2014) Significance test of the adjusted Rand index. Application to the free sorting task, Food Quality and Preference, (32)93-97
L. Hubert and p. Arabie (1985) Comparing partitions, Journal of Classification, 2, 193-218.
library(CrossClustering)
clusters <- iris[-5] |>
dist() |>
hclust(method = 'ward.D') |>
cutree(k = 3)
ground_truth <- iris[[5]] |>
as.numeric()
cc_test_ari(ground_truth, clusters)
#> $rand
#> [1] 0.8922595
#>
#> $expected_rand
#> [1] 0.5525751
#>
#> $adjusted_rand
#> [1] 0.7591987
#>
#> $var_ari
#> [1] 8.607097e-05
#>
#> $nari
#> [1] 81.83274
#>
#> $p_value
#> [1] 0
#>