Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Gini Calculation Module

j_brzezinski
8 - Asteroid
A Gini index provides a measure of diversity for a particular continuous or catagorical variable.  It is usually used to measure concentration of wealth or income.  There are some versions that provide an index of diversity, such as concentrations of species.  Is there a sample module or macro to do the calculations in Alteryx?
1 REPLY 1
kane_glendenning
10 - Fireball
Hi Joseph,

I haven't seen any samples with this and if one was to be built, then I probably wouldn't leave the inefficient join as below, but this is a quick solution.

Based on the formula for Gini Co-efficient from Wolfram:
 G=(sum_(i=1)^(n)sum_(j=1)^(n)|x_i-x_j|)/(2n^2mu)

The below set of tools will produce the Gini co-efficient:


Configurations as follows:
Join: On the field created in the preceding formula tool to get all possible combinations
Summarise: 3 Outputs:
  • Sum_Difference (Numerator of the equation)
  • Avg_Salary (mu, this should be the average of the variable of interest)
  • Max_RecordID (n, the number of observations)
You can change this depending on which version of Gini you would like to use. It would be an interesting Macro to make.

Kane
Labels