# ncchung/jaccard

Statistical test of similarity between binary data using the Jaccard/Tanimoto coefficients
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst/shinyapps/jaccard-shiny
man
src
.Rbuildignore
.gitattributes
.gitignore
.gitignore.swp
DESCRIPTION
NAMESPACE
jaccard.Rproj

# jaccard R package

This R package enables statistical testing of similarity between binary data using the Jaccard/Tanimoto similarity coefficient -- the ratio of intersection to union. Biochemical fingerprints, genomic intervals, and ecological communities are some examples of binary data in life sciences. For examples, competition between two different operational taxonomic units (OTUs) are often evaluated by a Jaccard/Tanimoto coefficient between their absence/presence vectors across multiple bioregions.

We provide 4 methods of computing statistical significance of such similarity coefficients for binary data: the exact solution, the asymptotic approximation, the bootstrap method, and the measure concentration algorithm. We recommand using either the bootstrap method or the measure concentration algorithm, since the exact solution can be slow and the asymptotic approximation could be inaccurate depending on the data size.

# Basic Usage

To install this package:

install.packages("devtools")
library("devtools")
install_github("ncchung/jaccard")

library("jaccard")

To compute the exact p-value of similarity between two binary vectors, x and y:

jaccard.test(x,y,method="exact")\$pvalue

When a length of a binary vector is moderately long, the bootstrap and the measure concentration algorithm (mca) are much faster while maintaining high accuracy:

jaccard.test(x,y,method="bootstrap",B=1000)
jaccard.test(x,y,method="mca",accuracy=1e-05)

Help documents can be loaded in R, such as:

? jaccard.test.bootstrap