Home › Guides › The Shannon diversity index, with a worked example
For ecology and biology students
The Shannon diversity index, with a worked example
Two meadows can hold the same number of species and still differ in diversity. The Shannon index counts both how many species there are and how evenly the individuals are spread among them.
In short
For each species, find its share p of all the individuals counted. Then H′ = −Σ p ln p, and the evenness J′ = H′ ÷ ln S, where S is the number of species. A higher H′ means a more diverse sample; J′ runs from 0, when one species dominates, to 1, when all are equally common.
Step by step
| Species | Count | p | −p ln p |
|---|---|---|---|
| A | 40 | 0.4 | 0.3665 |
| B | 30 | 0.3 | 0.3612 |
| C | 20 | 0.2 | 0.3219 |
| D | 10 | 0.1 | 0.2303 |
Adding up the last column gives H′ = 1.2799. With S = 4 species, ln 4 = 1.3863, so J′ = 1.2799 ÷ 1.3863 = 0.9232: a fairly even community.
Which logarithm?
The Shannon index can use the natural logarithm (giving units called nats), log base 2 (bits) or log base 10. The results differ only by a constant factor, but values computed with different bases can't be compared. JigWell uses the natural logarithm, the most common choice in ecology.
Simpson's index alongside
Simpson's index D = Σ p² is the chance that two individuals picked at random (with replacement) belong to the same species: 0.30 here. Many people report 1 − D (0.70, the chance that they differ) or 1 ÷ D (3.33, the effective number of equally common species). Some textbooks use the finite-sample form Σ n(n − 1) ÷ N(N − 1), which gives a slightly lower D.
Worked example
The same four counts entered in JigWell:
| Species richness, S | 4 |
|---|---|
| Individuals, N | 100 |
| Shannon H′ (nats) | 1.2799 |
| Evenness J′ | 0.9232 |
| Simpson D | 0.3 |
| 1 − D | 0.7 |
| 1 ÷ D | 3.333 |
Computed by JigWell's Field biology & survey → Biodiversity, richness & similarity tool (biodiversity) with counts = [40, 30, 20, 10].
Do it in JigWell
- Open Field biology & survey → Biodiversity, richness & similarity.
- Type the count for each species as a list, for example
40, 30, 20, 10. Zeros are ignored. - Read the richness, Shannon H′ and evenness, and the Simpson family side by side.
- To estimate how many species a survey missed, use Field biology & survey → Biodiversity, richness & similarity; to compare two sites, Field biology & survey → Biodiversity, richness & similarity.
Download JigWell, freeMore guides
For 64-bit Windows. Over 110 science and field tools; no internet, no account.
Good to know
- Compare H′ only between samples collected with similar effort: more effort finds more rare species and raises H′.
- Say which logarithm you used whenever you report a Shannon index.
Sources
- Shannon, C. E. (1948). A mathematical theory of communication. Bell System Technical Journal 27: 379–423.
- Magurran, A. E. (2004). Measuring Biological Diversity. Blackwell.