# SHANNON DIVERSITY INDEX   Diversity indices are statistics used to summarize the diversity of a population in which each member belongs to a unique group. For example, in ecology the groups are typically species. In ecology, species richness refers to number of species and species eveness refers to homogeneity of the species. That is, the more equal the proportions for each of the groups, the more homogeneous, or even, they are. Different fields of application may use different terminology for these concepts.

Given a vector of frequencies (counts), fi the Shannon diversity index is computed as

H=nlog(n)ki=1filog(fi)n

with k and n denoting the number of groups and the total count, respectively. If fi = 0, then the fi log(fi) 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

EH=Hlog(k)

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

H=ki=1pilog(pi)

with pi denoting the proportion in group k. As above, the Shannon equitability index is computed as

EH=Hlog(k)

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.

Syntax 1:

1. LET = SHANNON <DIVERSITY/EQUITABILITY> INDEX
1.                         <SUBSET/EXCEPT/FOR qualification>
1. where is the response variable;
1.             <DIVERSITY/EQUITABILITY> specifies whether the diversity or equitability index is computed;
1.             is a parameter where the Shannon diversity index is saved;
1. 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.

Syntax 2:

1. LET = RAW SHANNON <DIVERSITY/EQUITABILITY> INDEX
1.                         <SUBSET/EXCEPT/FOR qualification>
1. where is the response variable;
1.             <DIVERSITY/EQUITABILITY> specifies whether the diversity or equitability index is computed;
1.             is a parameter where the Shannon diversity index is saved;
1. and where the <SUBSET/EXCEPT/FOR qualification> is optional.

This syntax is used when the response variable is a group-id variable. The group frequencies will be computed automatically.

Examples:

1. LET SDI = SHANNON DIVERSITY P
1. LET SEI = SHANNON EQUITABILITY P

Note:The Shannon diversity/equitability is used in a wide variety of fields. It may be referred to by a different name or have a slightly different formulation in various fields.Dataplot statistics can be used in a number of commands.  