skbio.diversity.alpha.hill(counts, order=2)[source]#

Calculate Hill number.

Hill number (\(^qD\)) is a generalized measure of the effective number of species. It is defined as:

\[^qD = (\sum_{i=1}^S p_i^q)^{\frac{1}{1-q}}\]

where \(S\) is the number of taxa and \(p_i\) is the proportion of the sample represented by taxon \(i\).

counts1-D array_like, int

Vector of counts.

orderint or float, optional

Order (\(q\)). Ranges between 0 and infinity. Default is 2.


Hill number.


Hill number was originally defined in [1]. It is a measurement of “true diversity”, or the effective number of species (ENS) ([2]), which is defined as the number of equally abundant taxa that would make the same diversity measurement given the observed total abundance of the community.

Hill number is a generalization of multiple diversity metrics. Depending on the order \(q\), it is equivalent to:

  • \(q=0\): Observed species richness (\(S_{obs}\)).

  • \(q \to 1\): The exponential of Shannon index (\(\exp{H'}\)), i.e., perplexity.

  • \(q=2\): Inverse Simpson index (\(1 / D\)).

  • \(q \to \infty\): \(1/\max{p}\), i.e., the inverse of Berger-Parker dominance index.

The order \(q\) determines the influence of taxon abundance on the metric. A larger (or smaller) \(q\) puts more weight on the abundant (or rare) taxa.

Hill number is equivalent to the exponential of Renyi entropy.



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


Jost, L. (2006). Entropy and diversity. Oikos, 113(2), 363-375.