Understanding the Shannon and Simpson diversity index calculator — concept and principle
Diversity indices turn a list of species counts into a single number that reflects both how many species are present (richness) and how evenly individuals are spread among them (evenness). Enter the number of individuals counted for each species, separated by commas, and the calculator returns Shannon's H′, Pielou's evenness J′, Simpson's index 1 − Σp², the inverse Simpson index and species richness.
How it is calculated
- Proportions: pᵢ = nᵢ ÷ N, where nᵢ is the count of species i and N is the total. Zero counts are ignored.
- Shannon: H′ = −Σ pᵢ ln pᵢ (natural log).
- Evenness: J′ = H′ ÷ ln S, where S is the number of species.
- Simpson: D = 1 − Σ pᵢ², the probability that two individuals drawn at random (with replacement) belong to different species.
- Inverse Simpson: 1 ÷ Σ pᵢ², an "effective number of species".
The principle
Shannon's index comes from information theory: it measures the uncertainty in predicting the species of the next individual sampled. If one species dominates, the guess is easy and H′ is low; if many species are equally common, uncertainty is high. The maximum H′ for S species is ln S, reached when all are equally abundant, which is why J′ = H′ ÷ ln S runs from 0 to 1. Simpson's Σp² is the chance that two random individuals are the same species, so it is dominated by the commonest species and is less sensitive to rare ones.
Worked example
- Counts: 40, 25, 20, 10, 5; total N = 100, S = 5.
- Proportions: 0.40, 0.25, 0.20, 0.10, 0.05.
- pᵢ ln pᵢ: −0.3665, −0.3466, −0.3219, −0.2303, −0.1498; sum = −1.4150, so H′ = 1.415.
- J′ = 1.415 ÷ ln 5 = 1.415 ÷ 1.6094 = 0.879.
- Σp² = 0.16 + 0.0625 + 0.04 + 0.01 + 0.0025 = 0.275, so D = 0.725 and inverse Simpson = 1 ÷ 0.275 = 3.64.
- Species richness = 5.
How to read the result
H′ commonly falls between about 1.5 and 3.5 in ecological field data, but values only make sense when compared across samples collected and identified the same way. An inverse Simpson of 3.64 means the community is as diverse as one with about 3.6 equally common species, even though 5 are present, because the first species dominates.
Common mistakes
- Comparing H′ values calculated with different logarithm bases (ln, log₂, log₁₀).
- Comparing samples of very different size; richness rises with sampling effort.
- Confusing Simpson's Σp² (dominance) with 1 − Σp² (diversity) or with 1/Σp².
Frequently asked questions
Which index should I report?
Many studies report richness, Shannon H′ and inverse Simpson together, or Hill numbers, which put them on one scale of effective species.
How do I convert H′ to an effective number of species?
Take exp(H′). Here exp(1.415) ≈ 4.1 species.
Can I use percentage cover instead of counts?
Yes, if every species is measured the same way.
Sources: C. E. Shannon, "A mathematical theory of communication", Bell System Technical Journal 27 (1948) · E. H. Simpson, "Measurement of diversity", Nature 163, 688 (1949) · A. E. Magurran, Measuring Biological Diversity, Blackwell (2004)