How to use Shannon Biodiversity Index to Compare Biodiversity

What You Need to Know

Shannon Biodiversity Index (aka Shannon–Weaver or Shannon–Wiener index) is a quantitative way to compare biodiversity across communities using both:

  • Species richness (how many species)
  • Species evenness (how evenly individuals are distributed among species)

In AP Environmental Science, you’ll use it to compare two habitats (ponds, forests, fields, etc.) and justify which is more biodiverse based on abundance data.

Core definition & formula

You calculate Shannon diversity as:

H=i=1Spiln(pi)H' = -\sum_{i=1}^{S} p_i\ln(p_i)

Where:

  • HH' = Shannon diversity index
  • SS = number of species (species richness)
  • pip_i = proportion of individuals in species ii
  • pi=niNp_i = \frac{n_i}{N}
  • nin_i = number of individuals of species ii
  • NN = total individuals across all species
  • ln\ln = natural log (base ee)

How to interpret it:

  • Higher HH' = higher biodiversity (more richness and/or more evenness)
  • Lower HH' = lower biodiversity (dominated by one/few species)

Critical reminder: You can only compare Shannon index values meaningfully when the datasets were collected with similar sampling effort and method (same type of survey, similar area/time, similar taxonomic level).

When and why you use it

Use Shannon when:

  • You have species counts (abundances), not just a species list.
  • You need to compare communities where dominance matters (e.g., one invasive species taking over).
  • You want a single number capturing both richness + evenness.

Step-by-Step Breakdown

This is the fastest reliable method for exam problems.

1) Make a quick table

For each species, list:

  • nin_i
  • pi=niNp_i = \frac{n_i}{N}
  • ln(pi)\ln(p_i)
  • piln(pi)p_i\ln(p_i)
2) Compute the total abundance

Add all individuals:

N=niN = \sum n_i

3) Convert counts to proportions

For each species:

pi=niNp_i = \frac{n_i}{N}

Quick check: pi\sum p_i should be about 1.001.00 (tiny rounding error is fine).

4) Compute each contribution piln(pi)p_i\ln(p_i)
  • Since 0<pi10 < p_i \le 1, ln(pi)\ln(p_i) is negative.
  • So piln(pi)p_i\ln(p_i) is negative.
5) Sum and flip the sign

Add them up, then multiply by 1-1:

H=piln(pi)H' = -\sum p_i\ln(p_i)

6) Compare communities
  • Larger HH' → more diverse
  • If HH' values are close, look at:
    • richness (how many species)
    • evenness (dominance patterns)
Mini worked example (annotated)

Community A: 3 species with counts [50,25,25][50, 25, 25].

  • N=100N = 100
  • Proportions: [0.50,0.25,0.25][0.50, 0.25, 0.25]
  • Compute:
    • 0.50ln(0.50)0.50(0.693)=0.34650.50\ln(0.50) \approx 0.50(-0.693) = -0.3465
    • 0.25ln(0.25)0.25(1.386)=0.34650.25\ln(0.25) \approx 0.25(-1.386) = -0.3465
    • 0.25ln(0.25)0.34650.25\ln(0.25) \approx -0.3465
  • Sum: piln(pi)1.0395\sum p_i\ln(p_i) \approx -1.0395
  • Multiply by 1-1: H1.04H' \approx 1.04

Key Formulas, Rules & Facts

Shannon index essentials
ItemFormula / RuleWhen to useNotes
Proportion of species iipi=niNp_i = \frac{n_i}{N}AlwaysMake sure all nin_i are from the same sample.
Shannon diversityH=piln(pi)H' = -\sum p_i\ln(p_i)Compare biodiversity using richness + evennessUses natural log unless stated otherwise.
Maximum possible Shannon (given SS species)Hmax=ln(S)H'_{\max} = \ln(S)To judge how close to perfectly even a community isHappens when all species are equally abundant.
Evenness (common add-on)J=Hln(S)J = \frac{H'}{\ln(S)}Compare “fairness” of abundance across communities0J10 \le J \le 1. Higher = more even.
Interpretation rules (high-yield)
  • Richness effect: More species \Rightarrow usually higher HH' (but depends on evenness).
  • Evenness effect: More equal abundances \Rightarrow higher HH' even if richness stays the same.
  • Dominance kills diversity: If one species is most of the individuals, HH' drops.
About logarithms (don’t get burned)
  • Many classes use ln\ln (base ee). Some materials use log10\log_{10}.
  • If the log base changes, the numeric HH' changes, but comparisons are still valid only if the same base is used for all communities.

Exam-safe move: Use ln\ln unless the problem explicitly specifies another base.

Edge cases you should know
  • If a species has ni=0n_i = 0, then pi=0p_i = 0 and the term is treated as:

limp0+pln(p)=0\lim_{p\to 0^+} p\ln(p) = 0

So you don’t include absent species in the sum.


Examples & Applications

Example 1: Same richness, different evenness

Two communities each have 4 species.

Community 1 counts: [25,25,25,25][25, 25, 25, 25]

  • pi=0.25p_i = 0.25 each
  • H=4(0.25ln(0.25))=ln(0.25)=ln(4)1.386H' = -4\big(0.25\ln(0.25)\big) = -\ln(0.25) = \ln(4) \approx 1.386

Community 2 counts: [70,10,10,10][70, 10, 10, 10]

  • p=[0.70,0.10,0.10,0.10]p = [0.70, 0.10, 0.10, 0.10]
  • Compute pieces:
    • 0.70ln(0.70)0.70(0.357)=0.2500.70\ln(0.70) \approx 0.70(-0.357) = -0.250
    • 0.10ln(0.10)0.10(2.303)=0.2300.10\ln(0.10) \approx 0.10(-2.303) = -0.230 (three times) 0.691\Rightarrow -0.691
  • Sum 0.941\approx -0.941, so H0.94H' \approx 0.94

Conclusion: Community 1 has higher biodiversity because it’s far more even (less dominated).

Example 2: Higher richness doesn’t always “win” if dominance is extreme

Community A (3 species): [34,33,33][34, 33, 33]

  • Nearly even; HH' will be close to ln(3)1.099\ln(3) \approx 1.099.

Community B (5 species): [96,1,1,1,1][96, 1, 1, 1, 1]

  • Very high dominance; HH' will be low because p1=0.96p_1 = 0.96 makes most of the community effectively one species.

Conclusion: A can have higher HH' than B even though B has more species.

Example 3: Comparing biodiversity and reporting evenness

Community C has S=6S = 6 species and you calculated H=1.20H' = 1.20.

  • Max diversity for S=6S = 6 is:

Hmax=ln(6)1.792H'_{\max} = \ln(6) \approx 1.792

  • Evenness:

J=1.201.7920.67J = \frac{1.20}{1.792} \approx 0.67

Interpretation: Moderately even; some dominance exists.

Example 4: Typical FRQ-style “which site is more diverse?”

Site 1 counts: [40,30,20,10][40, 30, 20, 10]

  • N=100N = 100, p=[0.40,0.30,0.20,0.10]p = [0.40, 0.30, 0.20, 0.10]
  • Pieces:
    • 0.40ln(0.40)0.40(0.916)=0.3660.40\ln(0.40) \approx 0.40(-0.916) = -0.366
    • 0.30ln(0.30)0.30(1.204)=0.3610.30\ln(0.30) \approx 0.30(-1.204) = -0.361
    • 0.20ln(0.20)0.20(1.609)=0.3220.20\ln(0.20) \approx 0.20(-1.609) = -0.322
    • 0.10ln(0.10)0.10(2.303)=0.2300.10\ln(0.10) \approx 0.10(-2.303) = -0.230
  • Sum 1.279\approx -1.279 so H1.28H' \approx 1.28

Site 2 counts: [85,5,5,5][85, 5, 5, 5]

  • p=[0.85,0.05,0.05,0.05]p = [0.85, 0.05, 0.05, 0.05]
  • Pieces:
    • 0.85ln(0.85)0.85(0.163)=0.1390.85\ln(0.85) \approx 0.85(-0.163) = -0.139
    • 0.05ln(0.05)0.05(2.996)=0.1500.05\ln(0.05) \approx 0.05(-2.996) = -0.150 (three times) 0.450\Rightarrow -0.450
  • Sum 0.589\approx -0.589 so H0.59H' \approx 0.59

Answer: Site 1 is more biodiverse (higher HH' due to greater evenness).


Common Mistakes & Traps

  1. Forgetting the negative sign

    • What happens: You compute piln(pi)\sum p_i\ln(p_i) and report a negative number.
    • Why wrong: By definition HH' is the negative of that sum.
    • Fix: Final step is always H=piln(pi)H' = -\sum p_i\ln(p_i).
  2. Using counts instead of proportions

    • What happens: You plug nin_i directly into niln(ni)n_i\ln(n_i).
    • Why wrong: Shannon requires proportions pip_i.
    • Fix: Always compute pi=niNp_i = \frac{n_i}{N} first.
  3. Mixing log bases between communities

    • What happens: One site uses ln\ln and another uses log10\log_{10}.
    • Why wrong: Index values won’t be on the same scale.
    • Fix: Use the same log base for all comparisons (default ln\ln).
  4. Rounding too early

    • What happens: You round pip_i or ln(pi)\ln(p_i) heavily and the final HH' is off.
    • Why wrong: Small rounding errors add up across species.
    • Fix: Keep 3–4 decimals during work; round only at the end.
  5. Comparing indices from unequal sampling effort

    • What happens: Site A was sampled much more intensively (more individuals counted), so it “finds” more rare species.
    • Why wrong: Shannon depends on the observed community; under-sampling misses rare species and biases diversity downward.
    • Fix: Compare sites sampled similarly (same area/time/method) or state this limitation.
  6. Including species with ni=0n_i = 0 in the species count SS for max diversity

    • What happens: You compute ln(S)\ln(S) using a larger SS than actually observed.
    • Why wrong: SS should be the number of species present in that community/sample.
    • Fix: Only count species with ni>0n_i > 0 when computing SS (unless the problem defines SS differently).
  7. Interpreting HH' as a percent or a probability

    • What happens: You say “H=1.2H' = 1.2 means 120% diversity.”
    • Why wrong: HH' is an index (unitless) with meaning only via comparison.
    • Fix: Interpret directionally: higher/lower, more/less even, more/less dominated.
  8. Assuming more species always means higher HH'

    • What happens: You pick the site with higher richness even if one species dominates.
    • Why wrong: Shannon heavily reflects evenness.
    • Fix: Look at both richness and evenness; dominance can overwhelm richness.

Memory Aids & Quick Tricks

Trick / MnemonicWhat it helps you rememberWhen to use it
“Proportion → log → multiply → sum → flip”Order of operations to compute HH'Anytime you calculate Shannon by hand
“Even = Max”Perfectly even community gives maximum HH' for that SSWhen checking reasonableness using ln(S)\ln(S)
“Dominance drops diversity”Big pip_i for one species lowers HH'When interpreting which site is more diverse
Quick check: pi1\sum p_i \approx 1Catches math/table errors earlyBefore doing logs
Range check: 0Hln(S)0 \le H' \le \ln(S)Catches impossible answersAfter computing HH'

Quick Review Checklist

  • You can state the formula: H=piln(pi)H' = -\sum p_i\ln(p_i) with pi=niNp_i = \frac{n_i}{N}.
  • You compute NN correctly and verify pi1\sum p_i \approx 1.
  • You remember ln(pi)\ln(p_i) is negative (because 0<pi10 < p_i \le 1).
  • You multiply piln(pi)p_i\ln(p_i), sum, then apply the negative sign.
  • You interpret: higher HH' means more biodiversity via richness and/or evenness.
  • You can compute/interpret evenness using J=Hln(S)J = \frac{H'}{\ln(S)} when asked.
  • You don’t mix log bases or compare samples with clearly unequal sampling effort.

You’ve got this—if you can compute pip_i cleanly and stay organized, Shannon problems become automatic.