View source: R/dissimilarity.R
| dissimilarity | R Documentation |
Compute Bray-Curtis dissimilarity from proportional abundances.
dissimilarity(p1, p2)
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. |
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.
Numeric scalar or vector of Bray-Curtis dissimilarity values.
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
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.
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.