
SHANNON DIVERSITY INDEXName:
Given a vector of frequencies (counts), f_{i} the Shannon diversity index is computed as
with k and n denoting the number of groups and the total count, respectively. If f_{i} = 0, then the f_{i} log(f_{i}) term is set to 0. The maximum value of the index is LOG(k). This value occurs when each group has the same frequency (i.e., maximum eveness). The Shannon equitability index is simply the Shannon diversity index divided by the maximum diversity
This normalizes the Shannon diversity index to a value between 0 and 1. Note that lower values indicate more diversity while higher values indicate less diversity. Specifically, an index value of 1 means that all groups have the same frequency. Some analysts use 1  E(H) so that higher values indicate higher diversity. Some analysts also use 1/E(H). In some cases, you may have proportions rather than counts. In this case, the formula for the Shannon diversity index is
with p_{i} denoting the proportion in group k. As above, the Shannon equitability index is computed as
You may also have raw data. That is, each row of the response variable identifies which group that row belongs to. In this case, Dataplot will generate the frequency table and use the formulas above to compute the index.
<SUBSET/EXCEPT/FOR qualification> where <y> is the response variable; <DIVERSITY/EQUITABILITY> specifies whether the diversity or equitability index is computed; <par> is a parameter where the Shannon diversity index is saved; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used when the response variable is either a set of proportions or a set of counts. Dataplot sums the values in the response variable. If the sum equals 1, then it assumes the response variable contains proportions. Otherwise, it assumes the response variable contains frequencies. In either case, if negative values are encountered an error is reported.
<SUBSET/EXCEPT/FOR qualification> where <y> is the response variable; <DIVERSITY/EQUITABILITY> specifies whether the diversity or equitability index is computed; <par> is a parameter where the Shannon diversity index is saved; and where the <SUBSET/EXCEPT/FOR qualification> is optional. This syntax is used when the response variable is a groupid variable. The group frequencies will be computed automatically.
LET SEI = SHANNON EQUITABILITY P
The SHANNON DIVERSITY INDEX command is not typically used in the context of these other commands.
Shannon, C.E. (July and October 1948), "A mathematical theory of communication," Bell System Technical Journal, 27: 379–423 and 623–656. Brani Vidakovic (2011), "Statistics for Bioengineering Sciences: With MATLAB and WinBUGS Support," Springer, p. 23.
let p = data 0.25 0.15 0.40 0.20 let nk = size p . let a = shannon diversity index p let b = shannon equitability index pThe following output is generated THE COMPUTED VALUE OF THE CONSTANT A = 1.319545 THE COMPUTED VALUE OF THE CONSTANT B = 0.9518508 . . Following example from page 23 of: . . Brani Vidakovic (2011), "Statistics for Bioengineering . Sciences: With MATLAB and WinBUGS Support", Springer. . read y x 115 1 108 1 25 1 6 1 28 1 25 1 6 1 1 1 220 2 134 2 183 2 39 2 12 2 6 2 6 2 12 2 83 3 104 3 16 3 8 3 14 3 18 3 2 3 1 3 99 4 94 4 21 4 8 4 18 4 18 4 5 4 2 4 end of data . set write decimals 4 tabulate shannon diversity index y x tabulate shannon equitability index y xThe following output is generated Cross Tabulate SHANNON DIVERSITY INDEX (Response Variables: Y )  X  SHANNON DIVERSI  1.0000  1.5230 2.0000  1.4816 3.0000  1.4356 4.0000  1.5191 Cross Tabulate SHANNON EQUITABILITY INDEX (Response Variables: Y )  X  SHANNON EQUITAB  1.0000  0.7324 2.0000  0.7125 3.0000  0.6904 4.0000  0.7305 . let yn = cross tabulate sum y x let pn = y/yn tabulate shannon diversity index pn x tabulate shannon equitability index pn xThe following output is generated Cross Tabulate SHANNON DIVERSITY INDEX (Response Variables: PN )  X  SHANNON DIVERSI  1.0000  1.5230 2.0000  1.4816 3.0000  1.4356 4.0000  1.5191 Cross Tabulate SHANNON EQUITABILITY INDEX (Response Variables: PN )  X  SHANNON EQUITAB  1.0000  0.7324 2.0000  0.7125 3.0000  0.6904 4.0000  0.7305  
Privacy
Policy/Security Notice
NIST is an agency of the U.S. Commerce Department.
Date created: 12/08/2011 