0
$\begingroup$

I want to calculate the Gini coefficient of a dataset of assets for which I the cumulative share of the population $W$ and the monthly returns $Y$.

$$G=1-\sum _{{k=0}}^{{n-1}}(X_{{k+1}}-X_{{k}})(Y_{{k+1}}+Y_{{k}})$$

where $X$ is the cumulative share of the population, and $Y$ is the cumulative share of income.

This would have been easy if I had one value per $Y_i$. The problem is that these last ones are vectors of monthly returns on several years.

Therefore how can I calculate the Gini coefficient from vectors of income rather than cumulative income ? Should I take the mean ? the median ? The sum ?

Data

Here is $Y$, the monthly returns:

> monthly_return
                   .SXQR         .SXTR         .SXNR         .SXMR         .SXAR         .SX3R
2000-01-01 -0.0904806270 -7.060242e-02 -5.688696e-02  1.385279e-01 -0.0794298017 -7.370042e-02
2000-02-01 -0.0254723999 -1.775260e-02  8.995378e-02  2.276832e-01 -0.0074883983  2.070630e-02
2000-03-01  0.0434480046  7.202347e-02 -4.419912e-02 -1.189531e-01  0.0421910755  5.908376e-02
...
2004-05-01            NA            NA            NA            NA            NA            NA
2004-06-01  1.444165e-02  0.0173759387  0.0141495050  0.0549388648  0.0561511659  0.0183186673
2004-07-01  3.510132e-02 -0.0108987061 -0.0159491884 -0.1208053691 -0.0445387063  0.0553659669

And $W$, the individual weights.

> w
           [,1]       [,2]       [,3]       [,4]       [,5]       [,6]       [,7]       [,8]
[1,] 0.04591712 0.04078667 0.04126135 0.05131896 0.04349168 0.04834431 0.04694083 0.03904389
           [,9]      [,10]      [,11]      [,12]      [,13]      [,14]     [,15]      [,16]
[1,] 0.04117694 0.04537461 0.04692524 0.04045692 0.04696848 0.05087293 0.1713231 0.08499888
          [,17]     [,18]
[1,] 0.04396601 0.0708321

That can be easily transformed to $X$ with the R function cumsum().

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.