help mata mm_gini()-------------------------------------------------------------------------------

Title

mm_gini() -- Gini coefficient

Syntax

real rowvectormm_gini(X[,w])where

X:real matrixcontaining data (rows are observations, columns variables)

w:real colvectorcontaining weights

Description

mm_gini(X,w)returns the Gini coefficient of each column ofX.

wspecifies the weights. Omitw, or specifywas 1 to obtain unweighted results. Missing values inXorware omitted from the calculation.

RemarksThe formula used in

mm_gini()isG(x) = 2 * Cov0(x, F) / mu

where mu is the mean of x. Let N denote the number of observations (or sum of weights). Then,

Cov0(x, F) = DCP(x, F) / N

where DCP(x, F) denotes the deviation cross product between x and its (adjusted) empirical cumulative, F. To be precise, F is defined as

1 w_i F_i = - * ( SUM w_j - --- ), i = 1,...,n W x_j<=x_i 2

where w_i are weights and W is the total sum of weights.

Example:

: x = exp(invnormal(uniform(100,1))) : mm_gini(x, 1) .5158638536

Conformability

mm_gini(x,w):X:n x kw:n x 1or1 x 1result:1 x k

DiagnosticsNone.

Source codemm_gini.mata

AuthorBen Jann, ETH Zurich, jann@soz.gess.ethz.ch

Also seeOnline: help for

[M-5] mean(),moremataLinks to user-written programs: anogi, egen_inequal, inequal7, ineqerr,