Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
how to check the accuracy of the gini index calculated
Posted:
Jul 7, 2006 6:42 AM
|
|
Hi,
I have calculated Gini's coefficient from 3 different methods and I want to check the accuracy of these numerical methods. Can anyone suggest me how to check the accuracy of these methods. I have coded them in SAS 9.0 version. methods are as follows.
1) By calcualting the area under the lorenz curve and the X-axis (A) then gini = (1 - 2*A) macro for AUC is as follows
************************************************************************************;
*** MACRO FOR AREA UNDER THE CURVE ***;
CODE FOR THE AREA UNDER THE CURVE: It calculates the AUC by the 'trapezoidal method' (i.e. assuming that the points on your line were joined by straight). Method assumes that the input file does not contain any missing data ************************************************************************************;
%MACRO AREAUC(DATASET,x,y,NAME); DATA AREA (KEEP= AUC); SET &DATASET END = FINAL; retain AUC 0 &x 0 &y 0 ;
IF LAG(&y) NE . THEN AUC + ((&y + LAG(&y)) * (&x - LAG(&x)) / 2 ) ;
if FINAL then OUTPUT; /* CALL SYMPUT('AUC',AUC);*/ RUN; PROC PRINT NOOBS; VAR AUC; TITLE"AREA UNDER THE &NAME"; RUN; %MEND AREAUC; /* END OF AREAUC MACRO*/
2) from Brown formula:
G = ABS(1- SUM((X(k) - X(k-1))*(Y(k)+ Y(k-1))) Where: G is the Gini coefficient X(k) is the cumulated proportion of the score, for k = 0,...,n, with X0
= 0, Xn = 1. Y(k) is the cumulated proportion of the outcome, for k = 0,...,n, with Y0 = 0, Yn = 1. */
3) From algebraic formula. Given that the data is ordered from smallest to largest values of the variable of interest, the formula is:
SUM[(2*i - n -1)* X(i)' ] G= ----------------------------------- n*n*MU Where: i = is the individual's rank order number, n is the number of total individuals; x'i = is the individual's variable value (scores), and MU is the population average.
Thanks in advance regards, Puneet
|
|
|
|