shannon {abdiv} | R Documentation |

The Shannon index of diversity

```
shannon(x, base = exp(1))
brillouin_d(x)
heip_e(x)
pielou_e(x)
```

`x` |
A numeric vector of species counts or proportions. |

`base` |
Base of the logarithm to use in the calculation. |

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

`H = - \sum_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!}{\prod_i x_i!}} =
\frac{\log{N!} - \sum_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`

.

The Shannon diversity, `H \geq 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.

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.

```
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))
```

[Package *abdiv* version 0.2.0 Index]