From: puneetgupta13@gmail.com on
Hi,
Can anyone suggest me the algorithm to calculate the Gini's
Coefficient? I want to code the algorithm in SAS and want to plot the
Lorenz curve. So that Gini's Coefficient can be calculated.
Thanks in Advacne
Regards,
Puneet

From: Dirk Nachbar on
Puneet

try this program

/************************************************************************
Gini macro

The Gini coefficient is often calculated with the more practical Brown Formula
shown below:

G = | 1 - \sum_{k=1}^{n} (X_{k} - X_{k-1}) (Y_{k} + Y_{k-1}) |

G: Gini coefficient
X<sub>k</sub>: cumulated proportion of the population variable, for k =
0,...,n, with X<sub>0</sub> = 0, X<sub>n</sub> = 1<br>
Y<sub>k</sub>: cumulated proportion of the income variable, for k = 0,...,n,
with Y<sub>0</sub> = 0, Y<sub>n</sub> = 1<br>

Source: en.wikipedia.org
***************************************************************************/

options mprint mlogic;
%macro gini(data=,var=,out=all);
data &out;
data gini;
set &data;
where &var>=0;
run;

proc sort data=gini; by &var; run;

data gini (keep= &var &time id cumpay);
set gini;
id=_n_;
retain cumpay 0;
cumpay+&var;
run;

proc summary data=gini;
var id cumpay;
output out=max (drop=_type_ _freq_) max=;
run;

data _null_;
set max;
call symput('gdp',cumpay);
call symput('people',id);
run;

data gini;
set gini;
xk=cumpay/&gdp;
yk=id/&people;
xkk=xk-lag(xk);
ykk=yk+lag(yk);
gini=xkk*ykk;
run;

proc summary data=gini;
var gini;
output out=g (drop=_type_ _freq_) sum=;
run;

data &out;
set g;
gini=abs(1-gini);
run;
%mend;

Dirk Nachbar
Assistant Economist
Pensim2
Department for Work and Pensions
Level 4, The Adelphi
1-11 John Adam St
WC2N 6HT London
020 796 28531



puneetgupta13(a)GMAIL.COM
13/06/2006 09:45

To
SAS-L(a)LISTSERV.UGA.EDU@internet
cc

Subject
Help - Gini's Coefficient






Hi,
Can anyone suggest me the algorithm to calculate the Gini's
Coefficient? I want to code the algorithm in SAS and want to plot the
Lorenz curve. So that Gini's Coefficient can be calculated.
Thanks in Advacne
Regards,
Puneet

PLEASE NOTE: THE ABOVE MESSAGE WAS RECEIVED FROM THE INTERNET.
On entering the GSI, this email was scanned for viruses by the Government
Secure Intranet (GSi) virus scanning service supplied exclusively by Cable &
Wireless in partnership with MessageLabs.
In case of problems, please call your organisational IT Helpdesk.
The MessageLabs Anti Virus Service is the first managed service to achieve the
CSIA Claims Tested Mark (CCTM Certificate Number 2006/04/0007), the UK
Government quality mark initiative for information security products and
services. For more information about this please visit www.cctmark.gov.uk

**********************************************************************
This document is strictly confidential and is intended only for use by the addressee.
If you are not the intended recipient, any disclosure, copying, distribution or other
action taken in reliance of the information contained in this e-mail is strictly prohibited.
Any views expressed by the sender of this message are not necessarily those of the Department
for Work and Pensions.
If you have received this transmission in error, please use the reply function to tell us
and then permanently delete what you have received.
Please note: Incoming and outgoing e-mail messages are routinely monitored for compliance
with our policy on the use of electronic communications.
**********************************************************************



The original of this email was scanned for viruses by Government Secure Intranet (GSi) virus scanning service supplied exclusively by Cable & Wireless in partnership with MessageLabs.
On leaving the GSI this email was certified virus free.
The MessageLabs Anti Virus Service is the first managed service to achieve the CSIA Claims Tested Mark (CCTM Certificate Number 2006/04/0007), the UK Government quality mark initiative for information security products and services. For more information about this please visit www.cctmark.gov.uk
From: Andre Wielki on
see at
http://www.sprc.unsw.edu.au/tatlib/gini.sas
http://www.sprc.unsw.edu.au/tatlib/ginic.sas
http://www.public.iastate.edu/~pdixon/sas/bootgini.sas

but also
gini and lorenz
at
http://jacquot.ensae.net/Lorenz.html

hth
Andre

puneetgupta13(a)gmail.com a ?crit :
> Hi,
> Can anyone suggest me the algorithm to calculate the Gini's
> Coefficient? I want to code the algorithm in SAS and want to plot the
> Lorenz curve. So that Gini's Coefficient can be calculated.
> Thanks in Advacne
> Regards,
> Puneet
>
>


--
Andre Wielki
INED (Institut National d'Etudes D?mographiques)
133 Boulevard Davout 75980 Paris Cedex 20
33 (0) 1 56 06 21 54 FRANCE
 | 
Pages: 1
Prev: SYMGET
Next: Proc QLIM (bivariate probit)