ShannonDiversity: ShannonDiversity Shannon Diversity Metrics

View source: R/ShannonDiversity.R

ShannonDiversityR Documentation

ShannonDiversity Shannon Diversity Metrics

Description

Calculates a number of metrics based on the Shannon information entropy measure of diversity in a vector, x.

Usage

ShannonDiversity(x)

Arguments

x

1 x n vector.

Value

H

Shannon entropy-based metric of diversity. This captures the effects of both richnes (the length of the vector, n) and the evenennes of the distribution.

Hmax

The maximum possible value of H given a vector of the length n provided.

Hr

Relative evenness Hr = H/Hmax

Hcentral

The centralization or concentration of the values among the n elements

n

Number of elements in the vector.

effective.n

effective number of elements in the vector, given the distribution of the relative weights.

Note

The formulation for Shannon Diversity uses a natural logarithm. As the natural logarithm of zero is undefined, the input vector cannot contain zeros. Analytically, there are two approaches to dealing with this issue if your vector contains zeros. First, you can apply the analysis to only the non-zero elements. Second, you can add a tiny amount to all of the elements such that the zero elements are now very small numbers, relative the original vector values.

Author(s)

Stuart R. Borrett

Examples


data(oyster)

## throughflow diversity
T <- enaFlow(oyster)$T
ShannonDiversity(T)

## storage (biomass) biodiversity
## X <- oyster %v% "storage"
## ShannonDiversity(X)

SEELab/enaR documentation built on April 29, 2023, 8:40 a.m.