Learn R Programming

SciencesPo (version 1.3.9)

gini.simpson: Gini-Simpson Index

Description

Computes the Gini/Simpson coefficient. NAs from the data are omitted.

Usage

gini.simpson(x, na.rm = TRUE)

gini.simpson(x, na.rm = TRUE)

Arguments

x
A data.frame, a matrix-like, or a vector.
na.rm
A logical value to deal with NAs.
...
Additional arguements (currently ignored)

encoding

UTF-8

Details

The Gini-Simpson quadratic index is a classic measure of diversity, widely used by social scientists and ecologists. The Gini-Simpson is also known as Gibbs-Martin index in sociology, psychology and management studies, which in turn is also known as the Blau index. The Gini-Simpson index is computed as $1 - \lambda = 1 - \sum_{i=1}^R p_i^2 = 1 - 1/{}^2D$.

See Also

politicalDiversity.

Examples

Run this code
# generate a vector (of incomes)
x <- as.table(c(69,50,40,22))
rownames(x) <- c("AB","C","D","E")
gini.simpson(x)

Run the code above in your browser using DataLab