Compute the adjusted rand index given the estimated assignments and the true assiganments.

ARI(est, truth)

Arguments

est

A list of results returned from khaplotype or kmodes.

truth

A numeric or character vector of true assignemts.

Value

A numberic value between 0 and 1, which indicates agreement between two partitions.

References

  • Hubert L, Arabie P (1985). “Comparing partitions.” Journal of Classification, 193--218.

Examples

# Estimate cluster assignments by function `khaplotype`. datFile <- system.file("extdata", "sim.fastq", package = "CClust") res_khap <- khaplotype (K = 5, datafile = datFile, n_init = 3)
#> Minimum quality score: ( (40) #> Maximum quality score: G (71) #> Minimum read length: 251 #> Maximum read length: 251 #> Time cost: 1.030616 secs #> Log likelihood in 1th initialization: -108539.22 (5 iterations: 2979 4939) #> Time cost: 0.507379 secs #> Log likelihood in 2th initialization: -108624.68 (2 iterations: 5074 1) #> Time cost: 0.629404 secs #> Log likelihood in 3th initialization: -103563.00 (3 iterations: 2894 577) #> Time cost is: 2.167524 secs #> Best optimum is: -103562.999033
ass <- system.file("extdata", "assignment.txt", package = "CClust") true_assignments <- as.numeric(read.table(ass, header = F, sep = "")) # Compute the Adjusted Rand Index ARI(res_khap, true_assignments)
#> [1] 0.9513036