calcDiversity - Calculate the diversity index


calcDiversity calculates the clonal diversity index for a vector of diversity orders.


calcDiversity(p, q)


numeric vector of clone (species) counts or proportions.
numeric vector of diversity orders.


A vector of diversity scores D for each q.


This method, proposed by Hill (Hill, 1973), quantifies diversity as a smooth function (D) of a single parameter q. Special cases of the generalized diversity index correspond to the most popular diversity measures in ecology: species richness (q = 0), the exponential of the Shannon-Weiner index (q approaches 1), the inverse of the Simpson index (q = 2), and the reciprocal abundance of the largest clone (q approaches +\infty). At q = 0 different clones weight equally, regardless of their size. As the parameter q increase from 0 to +\infty the diversity index (D) depends less on rare clones and more on common (abundant) ones, thus encompassing a range of definitions that can be visualized as a single curve.

Values of q < 0 are valid, but are generally not meaningful. The value of D at q=1 is estimated by D at q=0.9999.


  1. Hill M. Diversity and evenness: a unifying notation and its consequences. Ecology. 1973 54(2):427-32.


# May define p as clonal member counts
p <- c(1, 1, 3, 10)
q <- c(0, 1, 2)
calcDiversity(p, q)

[1] 4.000000 2.594272 2.027027

# Or proportional abundance
p <- c(1/15, 1/15, 1/5, 2/3)
calcDiversity(p, q)
[1] 4.000000 2.594272 2.027027

See also

Used by alphaDiversity.