[R] Gini Coefficient

David Winsemius dwinsemius at comcast.net
Wed Oct 20 00:38:30 CEST 2010


On Oct 19, 2010, at 4:24 PM, Peter Francis wrote:

> 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.
>
> <PastedGraphic-2.pdf>

I think you should recheck your source document. That looks wrong. You  
might try comparing to the Wikipedia page.

You can also get quite a bit of useful information by searching. Here  
is a pre-packaged search strategy at Baron's r-help page (with non- 
standard target settings):

http://search.r-project.org/cgi-bin/namazu.cgi?query=gini+coefficient&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08&idxname=Rhelp10&idxname=Rhelp02

-- 
David.

>
>
>
> 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
>


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list