
gini(x)
ncol(x)
.x
are equal.
It reaches a maximum value of 1/nrow(x)
when all values are zero except for one.
The Gini index is only interpretable for non-negative quantities.
It is not meaningful if x
contains negative values.x <- matrix(rpois(20,lambda=5),10,2)
gini(x)
Run the code above in your browser using DataLab