Description Usage Arguments Details Value Author(s) Examples
Compute Rand Contingency Index from a contingency table..
1 | randIndexDetailed(cont.table, permute.cols = FALSE, permute.rows = FALSE)
|
cont.table |
a contingency table (supposed to contain counts). Can be produced by table() or other means. Can belong to any of the following classes: table, matrix or data.frame. |
permute.cols=FALSE |
permute columns of the contingency table by decreasing sum. |
permute.rows=FALSE |
permute rows of the contingency table by decreasing sum. |
... |
Additional parameters are passed to the function image() |
First version: 2016-12-26 Last modification: 2016-12-26
The Rand Consistency Index is a classical measure of the similarity between two classifications (e.g. clustering results). It relies on the number of consistent pairs, where "consistent" means either co-clusttered in both classifications or separated in both.
a list with the values of the computed parameters.
Jacques van Helden (Jacques.van-Helden@univ-amu.fr)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | clustering1 <- c(rep(c("a", "b","c"), times=c(4,2,1)))
clustering2 <- c(rep(c("X", "Y"), times=c(3,4)))
cont.table <- table(clustering1, clustering2)
## Example from Yeung and Ruzzo (2001) supplementary file
cont.table <- data.frame(v1 = c(1, 1, 0), v2 = c(1, 2, 0), v3=c(0, 1, 4), row.names=c("u1", "u2", "u3"))
result <- randIndexDetailed(cont.table)
print(result$consistency.table)
print(signif(unlist(result[c("n", "Npairs", "RI", "ARI")]), digits=3))
## Check the result with another implementation
flexclust::randIndex(as.table(as.matrix(cont.table)), correct=TRUE)
## Draw heatmaps of the contingency tables
heatmap.simple(cont.table)
heatmap.simple(result$cont.table)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.