Skip to content

Beta diversity between samples from taxon abundances, by a named metric

eco_beta_diversity

Works out the Bray–Curtis, Jaccard or Sørensen dissimilarity of every pair of samples from taxon abundances.

Runs
On the server
Level
Checked against a reference: Another party's program: SciPy 1.18.1 run offline, with exact fractions and hand-worked cases
Ask your assistant

What it is

Returns the Bray–Curtis, Jaccard or Sørensen dissimilarity of every pair of samples from their taxon abundances. Use when comparing community composition between sites, samples or time points over one list of taxa. Not for sequence distance or aligning sequences: use `seq_align`. Abundances 0 or more in unit 1 or %; Bray–Curtis needs the abundance basis stated; an empty pair is withheld.

Field: Genetics, evolution and ecology.

What it does

You give

  • metric (required): The dissimilarity: bray-curtis, jaccard or sorensen.
  • samples (required): The samples, at least 2 and at most 20.
  • abundanceBasis: Bray–Curtis only, and required there: as-given (the values as given) or proportions (each sample rescaled to sum to 1). Leave out for jaccard and sorensen. Optional.

No request is recorded for this tool.

Limits

  • Research and teaching arithmetic on the caller's data.
  • Not for diagnosis, genetic counselling, clinical, breeding, conservation-management or animal-welfare decisions.
  • The tool checks arithmetic, not the data.
  • Pairwise dissimilarity on the values given over one list of taxa; not for sequence distance; no ordination or test.
  • Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.

It will not answer when

  • the samples list different numbers of taxa.
Every input, with its units3 inputs
  • metric (required): The dissimilarity: bray-curtis, jaccard or sorensen.
  • samples (required): The samples, at least 2 and at most 20.
  • abundanceBasis: Bray–Curtis only, and required there: as-given (the values as given) or proportions (each sample rescaled to sum to 1). Leave out for jaccard and sorensen. Optional.
Every refusal, with its code1 refusal
CodeWhen
TAXA_COUNTS_DIFFERthe samples list different numbers of taxa.

The calculation

The method's equations, constants and worked example.

Pairwise beta diversity between samples by Bray–Curtis, Jaccard or Sørensen dissimilarityeco-beta-diversity@1.0.2

Equation 1

d = Σᵢ|uᵢ − vᵢ| / Σᵢ(uᵢ + vᵢ), on the values used (as given, or uᵢ/Σu and vᵢ/Σv)

SymbolMeaning
dBray–Curtis dissimilarity of the pair
uᵢ, vᵢabundance of taxon i in each sample; a value given in % is divided by 100 first, so samples in % and in unit 1 are put on one scale

Source 1.

Equation 2

d = (c10 + c01) / (c11 + c10 + c01), counting taxa present (value above 0) in both, in the first only and in the second only

SymbolMeaning
dJaccard dissimilarity on presence/absence
c11, c10, c01numbers of taxa present in both, the first only, the second only

Source 2.

Equation 3

d=(c10+c01)/(2·c11+c10+c01)
SymbolMeaning
dSørensen dissimilarity on presence/absence
c11, c10, c01numbers of taxa present in both, the first only, the second only

Source 1.

Conventions

  • metric = bray-curtis: Bray–Curtis dissimilarity, the sum of absolute differences over the sum of both samples, on the values as given or as proportions, in unit 1
  • metric = jaccard: Jaccard dissimilarity, the share of taxa present in either sample that are present in only one, in unit 1
  • metric = sorensen: Sørensen dissimilarity, taxa present in only one sample over the summed numbers of taxa present in each, in unit 1

A definition, not a model: the equation states what the quantity means. A different convention gives a different number.

Worked example

Worked example: one case of eco-beta-diversity@1.0.2, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

Inputs

  • metric = bray-curtis
  • samples[0].name = u
  • samples[0].abundances[0] = 1
  • samples[0].abundances[1] = 1
  • samples[0].abundances[2] = 0
  • samples[1].name = v
  • samples[1].abundances[0] = 0
  • samples[1].abundances[1] = 1
  • samples[1].abundances[2] = 0
  • abundanceBasis = as-given

Steps

  1. d = 0.33333333, from samples[0].abundances, samples[1].abundances; by equation 1; gives dissimilarities[0].dissimilarity.

The working, as the case writes it:

sum|u - v| = 1 + 0 + 0 = 1

sum(u + v) = 1 + 2 + 0 = 3

d = 1/3 = 0.33333333 (SciPy's documentation prints 0.3333...).

Answer

dissimilarities[0].dissimilarity = 0.33333333

Where these values came from: an outside program, SciPy (scipy.spatial.distance) 1.18.1; scipy.spatial.distance (braycurtis) 1.18.1, run offline; exact fractions asserted to agree.

At build the tool returned this answer within the tolerance the file states: dissimilarities absolute 1e-14; statuses, codes, names, units and withheld rules exact.

Sources

  1. Somerfield PJ. Identification of the Bray-Curtis similarity index: Comment on Yoshioka (2008). Marine Ecology Progress Series 2008; 372: 303–306

    Used for: Pairwise beta diversity between samples by Bray–Curtis, Jaccard or Sørensen dissimilarity. At: equation 1 and 2, p. 303–304, section after Bray and Curtis 1957, as stated in Somerfield 2008: S_jk = 100·Σᵢ 2 min(y_ij, y_ik)/Σᵢ(y_ij + y_ik) (Eq. 1) = 100·{1 − Σᵢ|y_ij − y_ik|/Σᵢ(y_ij + y_ik)} (Eq. 2), and dissimilarity = 1 − similarity on the unit scale (p. 305); the rescaling to proportions is the record's option, a pretreatment Somerfield keeps apart from the coefficient (p. 304); p. 304, section after Sørensen 1948, as stated in Somerfield 2008: 'For presence/absence data, Eqs. (1) or (2) become the Sørensen or Dice coefficient'; Eq. (2) on 0/1 indicators gives Σ|u − v| = c10 + c01 and Σ(u + v) = 2·c11 + c10 + c01, the record's derivation.

    Read in full, 24 November 2026
  2. Jaccard P. Distribution de la flore alpine dans le bassin des Dranses et dans quelques régions voisines. Bulletin de la Société Vaudoise des Sciences Naturelles 1901; 37: 241–272

    Used for: Pairwise beta diversity between samples by Bray–Curtis, Jaccard or Sørensen dissimilarity. At: p. 249, footnote 1 (PDF page 271), section the coefficient of community: common species over the different species of the two lists, 295 of 525 for Trient and Wildhorn; Jaccard states the similarity, and the dissimilarity is one less it, which is this record's step.

    Read in full, 14 November 2026

How it is checked

Level

Checked against a reference.

Checked against

An outside program, SciPy (scipy.spatial.distance), 1.18.1; our own exact-arithmetic script and a hand-worked case.

Cases

No case set is linked to this version.

Not checked

Bray and Curtis 1957 and Sørensen 1948 were not read; their equations rest on Somerfield 2008, which also says Bray and Curtis attributed the coefficient to Gleason 1920 and that it is Steinhaus's or Odum's. Bray and Curtis computed it after a double standardisation (species as a percentage of their maximum, then of the sample total; Yoshioka 2008, MEPS 368:309–310), which the tool does not offer: on values as given or per-sample proportions it is the coefficient Yoshioka calls Czekanowski's and Somerfield calls Bray–Curtis.

What was not checked, in fullfrom the method records
  • Bray and Curtis 1957 and Sørensen 1948 were not read; their equations rest on Somerfield 2008, which also says Bray and Curtis attributed the coefficient to Gleason 1920 and that it is Steinhaus's or Odum's.
  • Bray and Curtis computed it after a double standardisation (species as a percentage of their maximum, then of the sample total; Yoshioka 2008, MEPS 368:309–310), which the tool does not offer: on values as given or per-sample proportions it is the coefficient Yoshioka calls Czekanowski's and Somerfield calls Bray–Curtis.
  • Jaccard 1901 was read, and states the similarity, of which the dissimilarity is the complement (Drybench ruling, 11 November 2026).
  • Rarefaction, quantitative Jaccard, phylogenetic metrics (UniFrac), ordination and any test are outside the method.
  • Whether the taxa are listed in the same order in every sample is the caller's.
Changes to its methods0 changes

No change is logged for these method versions.