gini_index
cellseg_gsontools.diversity.gini_index(x)
¶
Compute the gini coefficient of inequality for species.
Note
This is based on http://www.statsdirect.com/help/default.htm#nonparametric_methods/gini.htm.
Gini-index: $$ G = \frac{\sum_{i=1}^n (2i - n - 1)x_i} {n \sum_{i=1}^n x_i} $$
where \(x_i\) is the count of species \(i\) and \(n\) is the total count of species.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Sequence
|
The input value-vector. Shape (n, ) |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If there are negative input values. |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The computed Gini coefficient. |