Description Usage Arguments Details Value References Examples
Computes some criteria for comparing two classifications of the data points.
1 | compareCluster(class1, class2)
|
class1 |
A numeric or character vector of class labels. |
class2 |
A numeric or character vector of class labels. Must be same length of |
The Jaccard, Rand and adjusted Rand indices measure the agreement between two partitions of the units. These indices vary in the interval [0,1] and a value of 1 corresponds to a perfect correspondence. Note that sometimes the adjusted Rand index could take negative values (see Hubert, Arabie, 1985). The variation of information is a measure of the distance between the two clusterings and a small value is indication of closeness.
A list containing:
tab |
The confusion matrix between the two clusterings. |
jaccard |
Jaccard index. |
RI |
Rand index. |
ARI |
Adjusted Rand index. |
varInfo |
Variation of information between the two clusterings. |
Hubert, L. and Arabie, P. (1985). Comparing partitions. Journal of Classification, 2193-218.
Meila, M. (2007). Comparing clusterings - an information based distance. Journal of Multivariate Analysis, 98, 873-895.
1 2 3 4 | cl1 <- sample(1:3, 100, replace = TRUE)
cl2 <- sample(letters[1:4], 100, replace = TRUE)
compareCluster(cl1, cl2)
compareCluster(cl1, cl1) # perfect matching
|
Loading required package: poLCA
Loading required package: scatterplot3d
Loading required package: MASS
Package 'LCAvarsel' version 1.1
Type 'citation("LCAvarsel")' for citing this R package in publications.
$tab
class2
class1 a b c d
1 9 3 8 11
2 8 6 14 12
3 3 9 8 9
$jaccard
[1] 0.17
$randIndex
[1] 0.5808081
$adjRandIndex
[1] 7.320871e-05
$varInfo
[1] 2.371083
$tab
class2
class1 1 2 3
1 31 0 0
2 0 40 0
3 0 0 29
$jaccard
[1] 1
$randIndex
[1] 1
$adjRandIndex
[1] 1
$varInfo
[1] 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.