Gini index vs Herfindahl index: one increases while the other decreases I am comparing two vectors of values which indicate portfolio weights in monetary units at two different dates.

I wanted to quantify if the concentration in the portfolios changed. So I moved on with calculating the Gini index and the Herfindahl index for both vectors.

Now I got the  result that the Gini index increased, but the Herfindahl index decreased. How can I understand this result?

I did it in R, so I provide you with the values and the code:

 library(ineq)

V0 &lt;- c(6.162382e+01, 7.870565e+02, 2.922241e+03, 8.367593e-02, 3.306334e+01, 1.937308e+03, 2.114359e+01, 3.942730e+01, 2.682160e+00,
1.929470e+03, 2.052831e+03, 9.902533e+03, 9.603747e+03, 2.370503e+00, 3.841130e+01, 2.364905e+01, 3.627621e-01, 2.248296e+02,
2.330520e+03, 7.286694e+03, 5.218457e+00, 5.961622e-01, 0.000000e+00, 0.000000e+00, 5.048860e+03, 2.885924e+01, 3.051794e+02,
5.937953e+02, 6.668031e+00, 1.004851e+02, 3.319353e+02, 1.796081e+03, 1.407182e+03, 2.728721e+03, 3.892461e+04, 2.996096e+04)

V1 &lt;- c(1.07793e-03, 5.87720e-04, 1.95339e-04, 2.65183e+03, 8.58753e-04, 2.67605e-04, 4.86570e-05, 1.74857e-05, 1.00513e-04, 5.18214e+03,
9.09578e+03, 3.23243e+04, 4.41746e-03, 2.11019e-05, 2.87357e+04, 6.10592e+03, 2.25064e-03, 1.24105e-03, 1.63327e+04, 1.47689e-03,
1.60764e-04, 9.70041e-04, 2.64918e-06, 2.13185e-04, 1.95118e-03, 3.50591e+03, 2.97961e-03, 1.34459e-04, 1.10588e+03, 3.30131e-05,
2.41992e-04, 1.03209e-04, 2.25949e-03, 1.93734e-02, 1.50010e+04, 3.98032e+02)

Gini(V0)
[1] 0.8202071
Gini(V1)
[1] 0.8503999
Herfindahl(V0)
[1] 0.187598
Herfindahl(V1)
[1] 0.1744127


Clearly, both vectors are rather unequal distributed. The high Gini index says exactly that. The Herfindahl index is rather low to my feelings, but I am not very experienced with inequality/concentration measures.
They measure different things.  In particular the Gini index measures inequality and is strongly affected by the number of individuals with almost nothing, while the Herfindahl index measures the diversity of the shares (for example the choice in a market) and is almost unaffected by those with almost no share

If $n$ people had equal shares then the Gini index would be $0$, not changing as $n$ increased since inequality would not change, while the Herfindahl index would be $\frac1n$, reducing as $n$ increased to reflect greater diversity

As an an illustration, the following $36$ values give roughly the same results as your two examples

V2 &lt;- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
        0.05, 0.19, 0.19, 0.19, 0.19, 0.19)
Gini(V2)
# [1] 0.8527778
Herfindahl(V2) 
# [1] 0.183


But the zeros have no impact on the market shares and the Herfindahl index: having somebody extra with no share is as irrelevant as having nobody extra, and somebody with a tiny share is almost as irrelevant.  Removing those zeros would lead to 

V3 &lt;- c(0.05, 0.19, 0.19, 0.19, 0.19, 0.19)
Gini(V3)
# [1] 0.1166667
Herfindahl(V3)
# [1] 0.183


with the Gini index being much smaller (there is less inequality when those with nothing are excluded from consideration) but the Herfindahl index staying the same, corresponding to somewhere between $5$ and $6$ equal shares

You could looking at the Lorenz curves for your examples with something from the package like 

plot(Lc(V0), col="blue")
lines(Lc(V1), col="red")


or something homemade like 

plot(c(0,1), c(0,1), type="l")
points((0:length(V0))/length(V0),cumsum(c(0,sort(V0)))/sum(V0), 
    type="b", col="blue")
points((0:length(V1))/length(V1),cumsum(c(0,sort(V1)))/sum(V1), 
    type="b", col="red")


gives a picture like this with V0 in blue and V1 in red



So you can see that there is a greater area between the diagonal and the red curve (V1) than between the diagonal and the blue curve (V0), explaing why V1 gives a higher Gini index.  This is largely due to V1 having more extremely low values than V0 does

But on the right hand side, the top two values are greater for blue (the cumulative sums of the others are lower), so shares are more concentrated for V0 leading to a higher Herfindahl index