dissimilarity: Bray-Curtis Dissimilarity (Proportion Form)

View source: R/dissimilarity.R

dissimilarityR Documentation

Bray-Curtis Dissimilarity (Proportion Form)

Description

Compute Bray-Curtis dissimilarity from proportional abundances.

Usage

dissimilarity(p1, p2)

Arguments

p1

Numeric vector or matrix of proportional abundances for first community. See details.

p2

Numeric vector or matrix of proportional abundances for second community. See details.

Details

Calculates Bray-Curtis dissimilarity from proportional abundances using the formula sum(abs⁠(p1-p2))/2⁠. This is equivalent to the Bray-Curtis dissimilarity formula in the vegdist function of the vegan package when both communities have the same total counts (e.g., rarefied counts). This function is primarily intended to provide a method to compute Bray-Curtis dissimilarity from the posterior predictions of Dirichlet-multinomial regression models, which generate predictions of proportional abundances.

The dimensions of p1 and p2 must match. If p1 and p2 are matrices, then each record represents paired replicates for the communities (e.g., predictions from the same posterior draw). The elements (if p1 and p2 are vectors) or fields (if p1 and p2 are matrices) represent dimensions (e.g., taxa or species). If p1 and p2 are vectors, then a numeric scalar is returned. If p1 and p2 are matrices, then a numeric vector is returned whose elements correspond to the paired records of p1 and p2.

Value

Numeric scalar or vector of Bray-Curtis dissimilarity values.

References

Bray JR, and Curtis JT. 1957. An ordination of the upland forest communities of southern Wisconsin. Ecological Monographs, 27(4): 325-349. DOI: 10.2307/1942268

Legendre P, and Legendre L. 2012. Numerical Ecology: Third Edition. Elsevier.

Odum EP. 1950. Bird populations of the Highlands (North Carolina) Plateau in relation to plant succession and avian invasion. Ecology, 31(4): 587-605. DOI: 10.2307/1931577

See Also

dmreg for fitting Dirichlet-multinomial regression models.

dmpredict for generating predictions from Dirichlet-multinomial regression models.

diversity for computing Hill diversity from proportional abundances.

richness for computing species richness from occupancy probabilities.

Examples

# Compute Bray-Curtis dissimilarity.
dissimilarity(p1=c(0.15,0.25,0.4,0.2),
              p2=c(0.25,0.35,0.1,0.3))

LocaTT documentation built on June 14, 2026, 1:06 a.m.