jaccard {abdiv}R Documentation

Beta diversity for presence/absence data


These functions transform the input vectors to binary or presence/absence format, then compute a distance or dissimilarity.


jaccard(x, y)

sorenson(x, y)

kulczynski_first(x, y)

kulczynski_second(x, y)

rogers_tanimoto(x, y)

russel_rao(x, y)

sokal_michener(x, y)

sokal_sneath(x, y)

yule_dissimilarity(x, y)


x, y

Numeric vectors


Many of these indices are covered in Koleff et al. (2003), so we adopt their notation. For two vectors x and y, we define three quantities:

The quantity d is seldom used in ecology, for good reason. For details, please see the discussion on the "double zero problem," in section 2 of chapter 7.2 in Legendre & Legendre.

The Jaccard index of dissimilarity is 1 - a / (a + b + c), or one minus the proportion of shared species, counting over both samples together. Relation of jaccard() to other definitions:

The Sørenson or Dice index of dissimilarity is 1 - 2a / (2a + b + c), or one minus the average proportion of shared species, counting over each sample individually. Relation of sorenson() to other definitions:

I have not been able to track down the original reference for the first and second Kulczynski indices, but we have good formulas from Legendre & Legendre. The first Kulczynski index is 1 - a / (b + c), or one minus the ratio of shared to unshared species.

Relation of kulczynski_first to other definitions:

Some people refer to the second Kulczynski index as the Kulczynski-Cody index. It is defined as one minus the average proportion of shared species in each vector,

d = 1 - \frac{1}{2} \left ( \frac{a}{a + b} + \frac{a}{a + c} \right ).

Relation of kulczynski_second to other definitions:

The Rogers-Tanimoto distance is defined as (2b + 2c) / (a + 2b + 2c + d). Relation of rogers_tanimoto() to other definitions:

The Russel-Rao distance is defined (b + c + d) / (a + b + c + d), or the fraction of elements not present in both vectors, counting double absences. Relation of russel_rao() to other definitions:

The Sokal-Michener distance is defined as (2b + 2c) / (a + 2b + 2c + d). Relation of sokal_michener() to other definitions:

The Sokal-Sneath distance is defined as (2b + 2c) / (a + 2b + 2c). Relation of sokal_sneath() to other definitions:

The Yule dissimilarity is defined as 2bc / (ad + bc). Relation of yule_dissimilarity() to other definitions:


The dissimilarity between x and y, based on presence/absence. The Jaccard, Sorenson, Sokal-Sneath, Yule, and both Kulczynski dissimilarities are not defined if both x and y have no nonzero elements. In addition, the second Kulczynski index and the Yule index of dissimilarity are not defined if one of the vectors has no nonzero elements. We return NaN for undefined values.

[Package abdiv version 0.2.0 Index]