Description Usage Arguments Details Value Author(s) References Examples
Calculate Jaccard index for two binary vectors.
1 | getJaccard(cl1, cl2)
|
cl1 |
n by 1 binary vector of classification 1 for the n subjects |
cl2 |
n by 1 binary vector of classification 2 for the n subjects |
Jaccard Index is defined as the ratio
d/(b+c+d
, where d is the number of subjects who were classified to group 1 by both classification rules, b is the number of subjects who were classified to group 1 by classification rule 1 and were classified to group 0 by classification rule 2, c is the number of subjects who were classified to group 0 by classification rule 1 and were classified to group 1 by classification rule 2.
The Jaccard Index
Zeyu Zhang, Danyang Yu, Minseok Seo, Craig P. Hersh, Scott T. Weiss, Weiliang Qiu
Zhang Z, Yu D, Seo M, Hersh CP, Weiss ST, Qiu W. Novel Data Transformations for RNA-seq Differential Expression Analysis. (2019) 9:4820 https://rdcu.be/brDe5
1 2 3 4 5 6 7 8 9 10 11 | n = 10
set.seed(1234567)
# generate two random binary vector of size n
cl1 = sample(c(1,0), size = n, prob = c(0.5, 0.5), replace = TRUE)
cl2 = sample(c(1,0), size = n, prob = c(0.5, 0.5), replace = TRUE)
cat("\n2x2 contingency table >>\n")
print(table(cl1, cl2))
JI = getJaccard(cl1, cl2)
cat("Jaccard index = ", JI, "\n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.