Compute the empirical Hill diversity from abundances or relative abundances. Hill diversity is also the mean species rarity.

rarity(ab, l, q = NULL, na.rm = TRUE)

Arguments

ab

A numeric vector of species abundances or relative abundances.

l

Scaling exponent for the mean, can be any real number.

q

Scalar, traditional Hill number scaling exponent, q = 1-l where l is the scaling parameter for the generalized mean. Can be any real number.

na.rm

Logical, replace NA values with 0 abundance

Value

Generalized mean community rarity with scaling exponent "l".

When l = 1, arithmetic mean rarity (species richness).

When l = 0, geometric mean rarity (Hill-Shannon diversity), Shannon's entropy (Shannon and Weaver 1963) exponentiated.

When l = -1, harmonic mean rarity (Hill-Simpson diversity), the inverse of the Simpson concentration (Simpson 1949) .

Details

We parameterize Hill diversity \(D\) as a the frequency-weighted mean species rarity, with scaling exponent l $$D = \sum{p_i * r_i^{\ell}}^{-\ell}$$ where rarity of species i \(r_1 = 1/p_i\). When \(\ell = 0\) this is defined base on the limit from the left and the right, which is the geometric mean $$\exp(\frac{\sum{p_i * \ln(r_i)}}{\sum{p_i}})$$

This is equivalent to the \(q\) notation of Jost 2006 $$D=\sum{p_i^q}^{\frac{1}{1-q}}$$ where \(q=1-l\).

This function can also be called with dfun()

References

Simpson EH (1949). “Measurement of diversity.” Nature, 163, 688--688. doi:10.1038/163688a0 , 9411012, http://www.ncbi.nlm.nih.gov/pubmed/9230594. Shannon CE, Weaver W (1963). “The mathematical theory of communication.” The University of Illinois Press, 5(1), 1--131. ISSN 0724-6811, doi:10.1145/584091.584093 , http://www.ncbi.nlm.nih.gov/pubmed/9230594.

See also

Examples

rarity(c(20,8,5,4,2,1), 1) #species richness
#> [1] 6
rarity(c(20,8,5,4,2,1), 0) # Hill-Shannon diversity
#> [1] 4.057871
rarity(c(20,8,5,4,2,1), -1) # Hill-Simpson diversity
#> [1] 3.137255
rarity(c(20,8,5,4,2,1), q = 2) # The parameter `q` can be used instead for
#> Warning: l has been set to 1-q
#> [1] 3.137255
# traditional Hill number parameterization