skbio.diversity.alpha.simpson(counts, finite=False)[source]#

Calculate Simpson’s diversity index.

Simpson’s diversity index, a.k.a., Gini-Simpson index, or Gini impurity, is defined as:

\[1 - \sum_{i=1}^S{p_i^2}\]

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

Therefore, Simpson’s diversity index is also denoted as \(1 - D\), in which \(D\) is the Simpson’s dominance index.

Simpson’s diversity index can be interpreted as the probability that two randomly selected individuals belong to different taxa. It is also known as Hurlbert’s probability of interspecific encounter (PIE).

counts1-D array_like, int

Vector of counts.

finitebool, optional

If True, correct for finite sampling when calculating \(D\).


Simpson’s diversity index.

See also



Simpson’s diversity index was originally described in [1].

Hurlbert’s probability of interspecific encounter was described in [2].



Simpson, E. H. (1949). Measurement of diversity. Nature, 163(4148), 688-688.


Hurlbert, S. H. (1971). The nonconcept of species diversity: a critique and alternative parameters. Ecology, 52(4), 577-586.