gini()
is a measure of diversity that goes by a
number of different names, such as the probability of interspecific encounter
or the Gibbs-Martin index. It is \(1 - sum(p_i^2)\), where \(p_i\) is the
probability of observing class i.
The corrected Gini-Simpson index, ginicorr
takes the
index and corrects it so that the maximum possible is 1. If there are
k
categories, the maximum possible of the uncorrected index is
\(1-1/k\). It corrects the index by dividing by the maximum.
k
must be specified.
The modified Gini-Simpson index is similar to the unmodified, except it uses the square root of the summed squared probabilities, that is, \(1 - \sqrt{ sum(p_i^2)}\), where \(p_i\) is the probability of observing class i.
The modified corrected Gini index then
corrects the modified index for the number of categories, k
.
gini(x) ginicorr(x, k) sqrtgini(x) sqrtginicorr(x, k)
x | binary or categorical image or vector |
---|---|
k | number of categories |
The index (between 0 and 1), with 0 indicating no variation and 1
being maximal. The Gini index is bounded above by \(1-1/k\) for a group
with k
categories. The modified index is bounded above by
\(1-1/\sqrt{k}\). The corrected indices fix this by dividing by the
maximum.
#> [1] 0.75#> [1] 1#> [1] 0.5#> [1] 1