[R] Gini Coefficient

Peter Francis peterfrancis at me.com
Tue Oct 19 22:24:36 CEST 2010


Dear List,

I am unsure if this is specifically a R question or a stats question? I thought i would ask here and if i get no replies it will answer that!

I am trying to calculate Gini coefficients in R, based on a slight modification of the typical  equation that i have seen in a paper. 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.pdf
Type: application/pdf
Size: 10407 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101019/cc35593a/attachment.pdf>
-------------- next part --------------




where X is the cumulated proportion of Cars  and Y is the cumulated proportion of People. The value k indexes from the first to the next to last (n-1).

So i have a rough idea of how to implement this in R however i am unsure how the data should be sorted. Typically when i have calculated Gini coefficients in the past i have sorted "X" into ascending order then calculated the cumulative proportion from this. However if i have two factors X + Y i am unsure how to sort the data? I.E do i sort x and expand the section and also sort y based on the sorting of  X, or do i sort X calculate the coefficient then sort Y and calculate coefficient and add them together?

Once again i am sorry if this is completely the wrong place to ask such a question.

Peter








More information about the R-help mailing list