Estimate the Shannon-Wiener index

Description

Calculate estimates of the Shannon-Wiener index after pooling over several samples, grouped by a factor variable.

Usage

1

Arguments

X

a data.frame of dimension n times p with integer entries, where n is the number of samples and p is the number of species

f

a factor variable of length n, grouping the observations in X

Details

The function splits X according to the levels of the grouping variable f, builds the sum over each column and calculates the Shannon index ove the resulting counts.

Value

A list, containing the elements:

estimae

a named numeric vector, the groupwise Shannon indices with bias correction according to Fritsch and Hsu (1999)

estraw

a named numeric vector, the groupwise Shannon indices, without bias correction

varest

a named numeric vector, the groupwise variance estimates of the Shannon indices

table

a matrix, giving the summarized counts of the groups in the rows

References

Fritsch, KS, and Hsu, JC (1999): Multiple Comparison of Entropies with Application to Dinosaur Biodiversity. Biometrics 55, 1300-1305.

Examples

1
2
3
4
5
6
7
8
data(HCD)
HCD

# Groupwise point estimates:

est<-estShannonf(X=HCD[,-1], f=HCD[,1])

est

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.