# Computing Gini Index

I'm trying to compute the Gini coefficient of the following table:

|     | N1  | N2  | N3  |
| --- | --- | --- | --- |
| C1  | 1   | 2   | 1   |
| C2  | 4   | 1   | 1   |


These are my results:

$N1: 1− (1/5)^2−(4/5)^2=0.32$
$N2: 1− (2/3)^2−(1/3)^2=0.444$
$N3: 1− (1/2)^2−(1/2)^2=0.5$

Overall Gini is: $((5/10) × 0.32) + ((3/10) × 0.444) + ((2/10) × 0.5) = 0.3932$

But according to my sheets, the result must be $0.660$.

Am I wrong?

• Looks correct to me. If you compute the average Gini on the rows you get 0.55 which is yet different from 0.66 – Simone Dec 8 '15 at 23:01