ineq is an R package for measuring distributional inequality. Its ineq() function accepts a numeric vector and returns a Gini coefficient, while Lc() supports Lorenz-curve analysis. section 12.2 section 13.6.2
Use ineq to:
- Compute Gini coefficients for individual distributions or grouped observations such as annual salaries and win shares. section 12.5 section 13.4
- Interpret coefficients from 0, representing perfect equality, toward 1, representing perfect inequality. section 13.4
- Pair Gini summaries with ggplot2 line charts to compare inequality across seasons. section 12.5 section 13.4
- Generate multiple Lorenz curves by passing prepared vectors to Lc() inside a base R loop. section 13.6.2
Comparing simple income distributions
a <- rep(50, each = 10) ineq(a) ## [1] 0 f <- rep(c(10, 100), times = c(9, 1)) ineq(f) ## [1] 0.4263158 Equal incomes produce a Gini coefficient of 0; concentrating income in one person raises it to about 0.43. Scaling every income upward does not necessarily change the coefficient. section 12.5
library(tidyverse) library(sqldf) library(ineq) library(gglorenz) library(scales) library(effsize)
Load ineq before calling its functions; install it first when necessary. section 12.2
