Enter the number of data points and each data point in ascending order into the calculator to determine the Gini Index. This calculator can also evaluate any of the variables given the others are known.

Gini Index Formula

The following formula is used to calculate the Gini Index.

GI = 1 - 2 * (1 - (Σ_(i=1)^(n) (n + 1 - i) * y_i) / (n * Σ_(i=1)^(n) 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, for each data point, subtract its position in the sorted list from the total number of data points plus one, and multiply the result by the value of the data point. Sum these products for all data points. Divide this sum by the product of the total number of data points and the sum of all data points. Subtract this quotient from 1, and multiply the result by 2. Finally, subtract the result from 1 to get the Gini Index.

How to Calculate Gini Index?

The following steps outline how to calculate the Gini Index.


  1. First, determine the number of data points (n).
  2. Next, arrange the data points in ascending order.
  3. Next, calculate the sum of all the data points (Σ_(i=1)^(n) y_i).
  4. Next, calculate the sum of (n + 1 - i) * y_i for each data point.
  5. Next, calculate 1 - 2 * (1 - (Σ_(i=1)^(n) (n + 1 - i) * y_i) / (n * Σ_(i=1)^(n) y_i)).
  6. Finally, calculate the Gini Index (GI).
  7. 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