Learn R Programming

MCPAN (version 1.1-21)

estShannonf: Estimate the Shannon-Wiener index

Description

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

Usage

estShannonf(X, f)

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

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

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.

References

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

Examples

Run this code
# NOT RUN {
data(HCD)
HCD

# Groupwise point estimates:

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

est



# }

Run the code above in your browser using DataLab