rarity | R Documentation |
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)
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 |
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()
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 \insertCiteShannon1963MeanRarity exponentiated.
When l = -1
, harmonic mean rarity (Hill-Simpson diversity),
the inverse of the Simpson concentration
\insertCiteSimpson1949MeanRarity.
Simpson1949MeanRarity \insertRefShannon1963MeanRarity
pfun
, ipfun
rarity(c(20,8,5,4,2,1), 1) #species richness
rarity(c(20,8,5,4,2,1), 0) # Hill-Shannon diversity
rarity(c(20,8,5,4,2,1), -1) # Hill-Simpson diversity
rarity(c(20,8,5,4,2,1), q = 2) # The parameter `q` can be used instead for
# traditional Hill number parameterization
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.