Skip to main content
1 de 3

How to calculate Gini's index with categorical variables

I'd would like to calculate gini's index with categorical variables.

I have data with zones visited by people for example:

  • person 1: [zone2, zone4, zone5, zone2, zone2]
  • person 2 [zone1, zone5, zone4, zone1, zone1, zone3]
  • person 3 [zone3, zone3, zone3, zone1, zone3]

and I want to know how dispersed (or not very dispersed) is that person depending on the areas you visit in a parameter from 0 to 1. So, i want to obtain that person 3 is less disperse than person 1. I think that the value 0 of this parameter represent less dispersion. To do that i believe that gini's index represent that, but my variables (zones) are categorical.

Do you know how can i resolve this?