clues (version 0.5.9)

adjustedRand: Calculate Agreement Indices Between Two Partitions for a Data Set

Description

Calculate the five agreement indices: Rand index, Hubert and Arabie's adjusted Rand index, Morey and Agresti's adjusted Rand index, Fowlkes and Mallows's index, and Jaccard index, which measure the agreement between any two partitions for a data set.

Usage

adjustedRand(cl1, cl2, randMethod = c("Rand", "HA", "MA", "FM", "Jaccard"))

Arguments

cl1

partition 1 of a data set.

cl2

partition 2 of a data set. cl2 must have the same length as cl1, but could have different number of clusters.

randMethod

specifies the prefered external index to meaure the agreement between the two partitions cl1 and cl2. Available indices are: “Rand”, “HA” (Hubert and Arabie's adjusted Rand index), “MA” (Morey and Agresti's adjusted Rand index), “FM” (Fowlkes and Mallows's index), “Jaccard” (Jaccard index). By default, all 5 indices will be output.

Value

Returns a vector of the index values.

References

Milligan, G.W. and Cooper, M.C. (1986) A study of the comparability of external criteria for hierarchical cluster analysis. Multivariate Behavioral Research 21, 441--458.

Wang, S., Qiu, W., and Zamar, R. H. (2007). CLUES: A non-parametric clustering method based on local shrinking. Computational Statistics & Data Analysis, Vol. 52, issue 1, pages 286-298.

Examples

Run this code
# NOT RUN {
    cl1 <- c(1, 1, 1, 2, 2, 2, 2, 2)
    cl2 <- c(1, 2, 1, 2, 1, 2, 1, 3)
    adjustedRand(cl1, cl2)
    
    # perfect agreement
    cl1 <- c(1, 1, 2, 2)
    cl2 <- cl1
    adjustedRand(cl1, cl2)
    
# }

Run the code above in your browser using DataCamp Workspace