Enter the data points into the calculator to determine the Gini Index (Gini coefficient for inequality). The data will be sorted automatically, and the number of data points (n) can be inferred from your list. Note: this page is about the inequality Gini coefficient (0 = perfect equality, 1 = maximum inequality), not the decision-tree “Gini impurity.”
Related Calculators
- Gain Ratio Calculator
- Dominance Index Calculator
- Concordance Index Calculator
- Gamma Index Calculator
- All Statistics Calculators
Gini Index Formula
The following formula is used to calculate the Gini Index (Gini coefficient) from non-negative data sorted in ascending order.
GI = 1 + 1/n - (2 / (n * Σ_(i=1)^(n) y_i)) * Σ_(i=1)^(n) (n + 1 - i) * y_i
Variables:
- GI is the Gini Index
- n is the number of data points
- y_i is the i-th data point in ascending order
To calculate the Gini Index, first sort the data points in ascending order. Then compute the sum of all data points, Σ_(i=1)^(n) y_i. Next, compute the weighted sum Σ_(i=1)^(n) (n + 1 - i) * y_i. Finally, substitute these into GI = 1 + 1/n - (2 / (n * Σ y_i)) * Σ (n + 1 - i) * y_i. For non-negative data, GI ranges from 0 (perfect equality) to 1 (maximum inequality).
How to Calculate Gini Index?
The following steps outline how to calculate the Gini Index.
- First, determine the number of data points (n).
- Next, arrange the data points in ascending order.
- Next, calculate the sum of all the data points (Σ_(i=1)^(n) y_i).
- Next, calculate the sum of (n + 1 - i) * y_i for each data point.
- Next, calculate GI = 1 + 1/n - (2 / (n * Σ_(i=1)^(n) y_i)) * Σ_(i=1)^(n) (n + 1 - i) * y_i.
- Finally, report the Gini Index (GI).
- After inserting the variables and calculating the result, check your answer with the calculator above.
Example Problem :
Use the following variables as an example problem to test your knowledge.
Number of data points (n) = 5
Data points (y_i) in ascending order: 1, 2, 3, 4, 5
