What's "P and L"?
For the Lorenz curve of income distribution, gini index derives from
P and L where:
P: cumulated % of individuals
L: cumulated % of income
and the step-by-step calculation I was talking about looks like:
scalar area = 0
scalar gini = 0
loop i =
2..$nobs --quiet
area = (L[i] + L[i-1])*(P[i] - P[i-1]) + area # the area under the
Lorenz curve
endloop
area = (area + P[1]*L[1])/2
gini = (1 - 2 * area)
The very small difference came from the additional last (and pretty
small) term I missed : P[1]*L[1]
best,
artur