Skip to main content
`Ctrl`+`K`

# skbio.diversity.alpha.simpson

skbio.diversity.alpha.simpson(counts, finite=False)

  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).

  Parameters:
    counts 1-D array_like, int

      Vector of counts.

    finite bool, optional

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

  Returns:
    float

      Simpson’s diversity index.

  See also

  `dominance`

  Notes

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

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

  References

  [1]

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

  [2]

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