Calculates a number of metrics based on the Shannon information entropy measure of diversity in a vector, x.
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.