Hi Statlist members,
I want to calculate Gini coefficient and create variable called "gini" for each group of employees for each year
G = 1 + (1/n) - [ 2 / n^2 . TCmean)] [ TC1 + 2 TC2 + .....nTCn)
Where,
n = number of employees each year
TC = total compensation for each employee for each year , TC1
, TC2 ...TCn is the compensation paid to each of the employees in decreasing
order of size,
TCmean = is their mean total compensation
My data looks like,
I tried many codes but ends with errors , and I used - ineqdeco - package but I do not how to apply it to my data
Any suggestions ?
I want to calculate Gini coefficient and create variable called "gini" for each group of employees for each year
G = 1 + (1/n) - [ 2 / n^2 . TCmean)] [ TC1 + 2 TC2 + .....nTCn)
Where,
n = number of employees each year
TC = total compensation for each employee for each year , TC1
, TC2 ...TCn is the compensation paid to each of the employees in decreasing
order of size,
TCmean = is their mean total compensation
My data looks like,
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double YEAR str8 firmID double TC str6 employee_ID float n 2009 "00036020" 181.876 "36416" 5 2009 "00036020" 359.117 "36415" 5 2009 "00036020" 216.779 "36418" 5 2009 "00036020" 220.486 "36417" 5 2009 "00036020" 208.597 "36419" 5 2010 "00036020" 289.613 "36418" 5 2010 "00036020" 284.973 "36417" 5 2010 "00036020" 369.796 "36415" 5 2010 "00036020" 181.21 "36416" 5 2010 "00036020" 277.519 "36419" 5 2011 "00036020" 447.51 "36415" 4 2011 "00036020" 182.568 "36416" 4 2011 "00036020" 202.549 "36418" 4 2011 "00036020" 188.492 "36417" 4 2012 "00036020" 436.021 "36417" 6 2012 "00036020" . "47457" 6 2012 "00036020" 496.209 "36419" 6 2012 "00036020" 397.747 "36416" 6 2012 "00036020" 990.066 "36415" 6 2012 "00036020" 461.337 "36418" 6 2013 "00036020" 440.407 "36417" 7 2013 "00036020" 465.542 "36418" 7 2013 "00036020" 1124.996 "36415" 7 2013 "00036020" 440.649 "36419" 7 2013 "00036020" . "47457" 7 2013 "00036020" . "49230" 7 2013 "00036020" 403.883 "36416" 7 2014 "00036020" 712.042 "36417" 7 2014 "00036020" 2358.784 "36415" 7 2014 "00036020" 255.489 "36418" 7 2014 "00036020" 576.187 "36416" 7 2014 "00036020" 618.137 "47457" 7 2014 "00036020" 727.938 "36419" 7 2014 "00036020" . "49230" 7 2015 "00036020" . "51051" 7 2015 "00036020" . "55068" 7 2015 "00036020" 707.183 "36417" 7 2015 "00036020" 708.011 "36419" 7 2015 "00036020" 580.486 "36416" 7 2015 "00036020" 579.174 "49230" 7 2015 "00036020" 3505.532 "36415" 7 2016 "00036020" 658.928 "36416" 8 2016 "00036020" . "47457" 8 2016 "00036020" 891.171 "36419" 8 2016 "00036020" 467.546 "51051" 8 2016 "00036020" 697.613 "49230" 8 2016 "00036020" 881.83 "36417" 8 2016 "00036020" 4492.198 "36415" 8 2016 "00036020" . "55068" 8 2017 "00036020" . "58258" 9 2017 "00036020" 424.985 "36416" 9 2017 "00036020" 991.155 "49230" 9 2017 "00036020" 1455.461 "51051" 9 2017 "00036020" 4532.55 "36415" 9 2017 "00036020" 881.621 "55068" 9 2017 "00036020" 890.197 "36417" 9 2017 "00036020" 1097.299 "36419" 9 2017 "00036020" . "47457" 9 2018 "00036020" 984.931 "47457" 6 2018 "00036020" 1283.692 "55068" 6 2018 "00036020" 4320.379 "36415" 6 2018 "00036020" . "58258" 6 2018 "00036020" 1392.604 "36419" 6 2018 "00036020" 2196.599 "51051" 6 2019 "00036020" 2036.539 "36419" 5 2019 "00036020" 5382.645 "36415" 5 2019 "00036020" 3227.718 "51051" 5 2019 "00036020" 1591.217 "47457" 5 2019 "00036020" 1620.309 "58258" 5 2020 "00036020" . "61481" 6 2020 "00036020" 1036.374 "58258" 6 2020 "00036020" 2387.673 "51051" 6 2020 "00036020" 807.416 "47457" 6 2020 "00036020" 2336.581 "36415" 6 2020 "00036020" 961.326 "36419" 6 2021 "00036020" 1086.224 "58258" 6 2021 "00036020" 2912.109 "51051" 6 2021 "00036020" 906.761 "47457" 6 2021 "00036020" 1646.275 "36415" 6 2021 "00036020" 913.071 "36419" 6 2021 "00036020" 771.947 "61481" 6 2009 "00036110" 3055.124 "09252" 5 2009 "00036110" 1641.556 "36199" 5 2009 "00036110" 6435.641 "09249" 5 2009 "00036110" 1244.039 "23781" 5 2009 "00036110" 1770.594 "33979" 5 2010 "00036110" 1314.079 "36199" 5 2010 "00036110" 1578.104 "33979" 5 2010 "00036110" 5237.743 "09249" 5 2010 "00036110" 1596.902 "41787" 5 2010 "00036110" 2554.467 "09252" 5 2011 "00036110" 1081.963 "36199" 5 2011 "00036110" 2781.156 "09252" 5 2011 "00036110" 1727.069 "41787" 5 2011 "00036110" 5786.4 "09249" 5 2011 "00036110" 1696.431 "33979" 5 2012 "00036110" 1131.176 "44858" 5 2012 "00036110" 841.204 "19999" 5 2012 "00036110" 2068.554 "09252" 5 2012 "00036110" 4182.832 "09249" 5 end
I tried many codes but ends with errors , and I used - ineqdeco - package but I do not how to apply it to my data
Any suggestions ?
Comment