Hs: Shannon's Diversity Index

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/Hs.R

Description

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

Usage

1
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.

Details

This function is used within the H.sampler function.

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.

Author(s)

Raj Whitlock and Matthew K. Lau

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

1
2
x=rpois(25,10)
Hs(x)

Example output

[1] 3.150612

DiversitySampler documentation built on May 30, 2017, 4:20 a.m.