Learn R Programming

DiversitySampler (version 2.1)

Hs: Shannon's Diversity Index

Description

This function allows calculation of Shannon's diversity index (Shannon 1948).

Usage

Hs(obs,base=exp(1),corr=FALSE, scrub=TRUE)

Arguments

obs
A vector of species numbers.
base
The base of the logarithm used to calculate Shannon's index (DEFAULT = e).
corr
Correction factor for small sample sizes.
scrub
Controls the treatment of species with zero abundance in the input observation. If TRUE the input vector is truncated to omit zero values.

Value

When corr is FALSE the value of scrub will not influence the value returned by this function. When corr is TRUE and scrub is FALSE observations in the input vector that have value 0 will influence the output value through the correction factor -((nsp-1)/(2*nsamp)), where nsp is the number of species and nsamp is the total number of counts. This function is used within the H.sampler function.

Details

This function is used within the H.sampler function.

References

Shannon C.E. (1948) A mathematical theory of communication. Bell System Technical Journal 27: 379-423 and 623-656.

See Also

H.sampler, Gd

Examples

Run this code
x=rpois(25,10)
Hs(x)

Run the code above in your browser using DataLab