# shannon: Shannon diversity and related measures In kylebittinger/abdiv: Alpha and Beta Diversity Measures

## Description

The Shannon index of diversity

## Usage

 1 2 3 4 5 6 7 shannon(x, base = exp(1)) brillouin_d(x) heip_e(x) pielou_e(x) 

## Arguments

 x A numeric vector of species counts or proportions. base Base of the logarithm to use in the calculation.

## Details

The Shannon index of diversity or Shannon information entropy has deep roots in information theory. It is defined as

H = - ∑_i p_i \log{p_i},

where p_i is the species proportion. Relation to other definitions:

• Equivalent to diversity() in vegan with index = "shannon".

• Equivalent to shannon() in skbio.diversity.alpha.

The Brillouin index (Brillouin 1956) is similar to Shannon's index, but accounts for sampling without replacement. For a vector of species counts x, the Brillouin index is

\frac{1}{N}\log{\frac{N!}{∏_i x_i!}} = \frac{\log{N!} - ∑_i \log{x_i!}}{N}

where N is the total number of counts. Relation to other definitions:

• Equivalent to brillouin_d() in skbio.diversity.alpha.

• Equivalent to the shannon calculator in Mothur.

The Brillouin index accounts for the total number of individuals sampled, and should be used on raw count data, not proportions.

Heip's evenness measure is

\frac{e^H - 1}{S - 1},

where S is the total number of species observed. Relation to other definitions:

• Equivalent to heip_e() in skbio.diversity.alpha.

Pielou's Evenness index J = H / \log{S}. Relation to other definitions:

• Equivalent to peilou_e() in skbio.diversity.alpha.

## Value

The Shannon diversity, H ≥q 0, or related quantity. The value of H is undefined if x sums to zero, and we return NaN in this case. Heip's evenness measure and Pielou's Evenness index are undefined if only one element of x is nonzero, and again we return NaN if this is the case.

## References

Brillouin L. Science and Information Theory. 1956;Academic Press, New York.

Pielou EC. The Measurement of Diversity in Different Types of Biological Collections. Journal of Theoretical Biology. 1966;13:131-144.

## Examples

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 x <- c(15, 6, 4, 0, 3, 0) shannon(x) # Using a different base is the same as dividing by the log of that base shannon(x, base = 10) shannon(x) / log(10) brillouin_d(x) # Brillouin index should be almost identical to Shannon index for large N brillouin_d(10000 * x) shannon(10000 * x) heip_e(x) (exp(shannon(x)) - 1) / (richness(x) - 1) pielou_e(x) shannon(x) / log(richness(x)) 

kylebittinger/abdiv documentation built on Jan. 31, 2020, 3:13 p.m.