### We will be offering mothur and R workshops throughout 2019. Learn more.

# Shannon

Validate output by making calculations by hand

**Example Calculations**

***.shannon**

These files give the classic Shannon-Weaver Index of diversity.

<math>H_{Shannon} = - \sum_{i=1}^{S_{obs}} \frac{S_i}{N} ln \frac{S_i}{N} </math>

For the Amazonian dataset the Shannon Index is 4.35.

To obtain the 95% confidence interval we assume that the variance is normally distributed and can be calculated as

<math>var\left ( H_{Shannon} \right ) = \frac {\sum_{i=1}^{S_{obs}} \frac{S_i}{N} \left ( ln \frac{S_i}{N} \right )^2 - H_{Shannon}^{2}}{N} + \frac{S_{obs} - 1}{2N^{2}}</math>

The variance is 0.0020. This gives a lower and upper bound to the 95% confidence interval of
4.26 and 4.44.

**File Samples on the Amazonian Dataset**

- .sabund

This file contains data for constructing a rank-abundance plot of the OTU data for each distance level. The first column contains the distance and the second is the number of OTUs observed at that distance. The successive values in the row are the number of OTUs that were found once, twice, etc.

unique 2 94 2 0 2 92 3 0.01 2 88 5 0.02 4 84 2 2 10.03 4 75 6 1 20.04 4 69 9 1 2 0.05 4 55 13 3 2 0.06 4 48 14 2 4 0.07 4 44 16 2 4 0.08 7 36 15 4 2 1 0 1 0.09 7 36 12 4 3 0 0 2 0.1 7 35 12 2 3 0 0 3

- .shannon

The first line contains the labels of all the columns. First numsampled which shows the frequency of the observed calculations. The frequency was set to 10, so after each 10 selected the observed is calculated at each of the distances, with a calculation done after all are sampled. The following labels in the first line are the distances at which the calculations were made, the lci (lower bound of confidence interval) and the hci (higher bound of confidence interval). Note: the entire file is not shown below. Each additional line starts with the number of sequences sampled followed by the shannon calculation at the column's distance and the confidence intervals. For instance, at distance 0.01, after 80 samples shannon was 754.56, the lci was 238.89 and the hci was 2912.80.