calcDiv | R Documentation |
Function to calculate different common measures of diversity, and components (richness, evenness, disparity) thereof. Types of measures that can be calculated includes Hill diversity, Functional Hill diversity, Mean Pairwise Dissimilarity (MPD), Shannon's diversity, Simpson diversity, Rao's Q, Pielou's evenness and Hill evenness.
calcDiv(sampleData, compDisMat = NULL, type = "HillDiv", q = 1)
sampleData |
Data frame with the relative concentration of each compound (column) in every sample (row). |
compDisMat |
Compound dissimilarity matrix, as calculated by
|
type |
Type(s) of diversity or component(s) thereof to calculate.
Any of |
q |
Diversity order to use for Hill diversity, Functional Hill
Diversity and Hill Evenness. q should be equal to or larger than zero.
This parameter determines the sensitivity of the (Functional) Hill Diversity
measure to the relative frequencies of compounds. Commonly set to 0, 1 or 2,
although any value > 0 may be used. For |
The function calculates diversity and/or components thereof for each
sample in sampleData
. It can calculate the following indices:
Shannon
. Shannon's Diversity.
Simpson
. Simpson Diversity, often referred to as
the Inverse Simpson Index.
HillDiv
. Hill Diversity. Equation 4a/4b in Chao et al. 2014.
Also referred to as the Hill number or the effective number of
species (here compounds). The parameter q determines the sensitivity
of the measure to the relative frequencies of
compounds (see above for details). For q = 0
, this equals the
number of compounds in a sample, i.e. the richness. For q = 1
,
this equals the exponential of Shannon's Diversity. For q = 2
,
this equals the Simpson Diversity.
FuncHillDiv
. Functional Hill Diversity. There are
different versions of this. Here, the most common version is calculated.
This is the FD(Q), called "total functional diversity", calculated in
equation 4b/6b in Chiu & Chao 2014. This measure quantifies the
effective total dissimilarity between compounds in the sample.
Calculation of Functional Hill Diversity requires a compound
dissimilarity matrix. The parameter q determines the sensitivity of
the measure to the relative frequencies of compounds
(see above for details). For q = 1
, this is a measure
sensitive to compound richness, evenness and dissimilarity, and is therefore
the most comprehensive measure of diversity. For q = 0
, this is
equal to Functional Attribute Diversity (FAD) which is the sum of all
dissimilarities in the dissimilarity matrix.
MPD
. Mean Pairwise Dissimilarity. As the name suggests, this
is equal to the mean of the pairwise dissimilarities in the compound
dissimilarity matrix (excluding the 0 values in the diagonal). Therefore,
in contrast to FAD (see above) this measure is not dependent on the
number of compounds, and hence represents the disparity component
of diversity. Practically, MPD is calculated as Functional Hill Diversity
at q = 0
, divided by n(n-1), where n is the number of compounds,
i.e. Hill Diversity at q = 0
.
RaoQ
. Rao's quadratic entropy index Q.
The perhaps most common measure of functional diversity.
Requires a compound dissimilarity matrix. Rao's Q represents the
average dissimilarity of two randomly selected (weighed by
their proportions) compounds in the sample.
PielouEven
. Pielou's Evenness, also referred to as
Shannon's equitability. This is perhaps the most common evenness
measure. Equal to the Shannon's Diversity divided by the natural
logarithm of the number of compounds. In other words, it expresses evenness
with the observed Shannon's diversity as a proportion of the maximum
Shannon's diversity where all compounds are equally abundant. Therefore,
this is a relative measure with a minimum value of 0 and a maximum value
of 1. This measure of evenness is not replication invariant.
HillEven
. Hill Evenness, as defined by equation 8 in
Tuomisto 2012. This is equal to the Hill Diversity, at a given value
of q, divided by the number of compounds, and therefore
has a minimum value of 1 / number of compounds and maximum value of 1.
This measure of evenness is replication invariant. This measure can be
normalized to range from 0 to 1 (equation 13 in Tuomisto 2012).
Data frame with calculated diversity values for each sample.
Chao A, Chiu C-H, Jost L. 2014. Unifying Species Diversity, Phylogenetic Diversity, Functional Diversity, and Related Similarity and Differentiation Measures Through Hill Numbers. Annual Review of Ecology, Evolution, and Systematics 45: 297-324.
Chiu C-H, Chao A. 2014. Distance-Based Functional Diversity Measures and Their Decomposition: A Framework Based on Hill Numbers. PLoS ONE 9: e100014.
Hill MO. 1973. Diversity and Evenness: A Unifying Notation and Its Consequences. Ecology 54: 427-432.
Petren H, Koellner TG, Junker RR. 2023. Quantifying chemodiversity considering biochemical and structural properties of compounds with the R package chemodiv. New Phytologist 237: 2478-2492.
Petren H, Anaia RA, Aragam KS, Braeutigam A, Eckert S, Heinen R, Jakobs R, Ojeda L, Popp M, Sasidharan R, Schnitzler J-P, Steppuhn A, Thon F, Tschikin S, Unsicker SB, van Dam NM, Weisser WW, Wittmann MJ, Yepes S, Ziaja D, Meuller C, Junker RR. 2023. Understanding the phytochemical diversity of plants: Quantification, variation and ecological function. bioRxiv doi: 10.1101/2023.03.23.533415.
Tuomisto H. 2012. An updated consumer's guide to evenness and related indices. Oikos 121: 1203-1218
data(minimalSampData)
data(minimalCompDis)
calcDiv(sampleData = minimalSampData)
calcDiv(sampleData = minimalSampData, type = c("HillDiv", "HillEven"))
calcDiv(sampleData = minimalSampData, compDisMat = minimalCompDis,
type = "FuncHillDiv", q = 2)
data(alpinaSampData)
data(alpinaCompDis)
calcDiv(sampleData = alpinaSampData, compDisMat = alpinaCompDis,
type = "FuncHillDiv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.