Computing and interpreting diversity indices

A diversity index combines how many species are present with how individuals are distributed among them. Start with each species' relative abundance, pip_i, found by dividing its count by the total count. The proportions must sum to one before either index is calculated.

Calculate from proportions

Species richness is the number of species, while Shannon diversity also responds to their proportions: H=−∑ipiln⁡piH=-\sum_i p_i\ln p_i. This formula uses the natural logarithm; state the log base when reporting a value. A species with zero observed individuals contributes zero by the limiting convention pln⁡p→0p\ln p\to0 as p→0+p\to0^+, although richness normally counts only species present.


Simpson concentration is D=∑ipi2D=\sum_i p_i^2, whereas Gini–Simpson diversity is 1−D1-D. Both are dimensionless, and the word “Simpson” alone can refer to different conventions. Name the formula so a larger concentration is not confused with a larger diversity value.

Worked example

Consider a separate sample with species counts 6, 3, and 1, for a total of 10 individuals. Its proportions are 0.6, 0.3, and 0.1, which add to one. Squaring and summing gives D=0.62+0.32+0.12=0.46D=0.6^2+0.3^2+0.1^2=0.46, so 1−D=0.541-D=0.54.


Using natural logs for the same sample gives H=−(0.6ln⁡0.6+0.3ln⁡0.3+0.1ln⁡0.1)≈0.898H=-(0.6\ln0.6+0.3\ln0.3+0.1\ln0.1)\approx0.898. The results describe this distribution of observed proportions; they are not species counts. Stating both the input proportions and the selected formula makes the calculation reproducible.

Interpreting results

At fixed richness, greater evenness generally gives larger Shannon and Gini–Simpson diversity values. Under independent draws with replacement from the stated proportions, DD is the probability that two draws match species and 1−D1-D is the probability that they differ.


Sampling without replacement from a finite set of observed individuals has a different probability because the first draw changes the available counts.



Two samples each contain two species and ten individuals. Sample A has counts 5 and 5; sample B has counts 8 and 2. Which sample has higher Shannon diversity H = −Σ p ln p, and why? Use natural logarithms.

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A community has species counts 4, 3, and 3. Using the Gini–Simpson form 1 − Σ p², what is the index?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Mark Yourself Question

  1. Grab a piece of paper and try this problem yourself.
  2. When you're done, check the "I have answered this question" box below.
  3. View the solution and report whether you got it right or wrong.

A five-individual sample has counts 2, 2, and 1 across three species. Calculate Shannon H = −Σ p ln p using natural logarithms. Report to three decimal places.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors