A Lorenz curve shows how a quantity is distributed across a ranked population. Plot cumulative quantity on the x-axis and cumulative population on the y-axis, usually ranking observations from smallest to largest. The dashed diagonal represents perfect equality: the farther the curve bends away from it, the more unequal the distribution. section 12.6
A practical Lorenz-curve workflow:
- Filter the data to the season or population you want to study. section 12.6
- Check that the measured quantity contains no negative values; replace negative win shares with zero before plotting. section 13.5
- Use gglorenz::stat_lorenz(desc = FALSE) in a ggplot2 chart, keep equal axis ratios with coord_fixed(), and add the equality line with geom_abline(). section 12.6
- Compare curves or their Gini coefficients to discuss relative inequality. section 13.5
NBA salary and win-share distributions
A 1993–94 salary curve has a Gini coefficient of 0.39, while a 1996–97 curve has 0.52. For win shares, the 1990–91 curve has a coefficient of 0.56, compared with 0.49 in 2016–17. These comparisons turn a distribution into a visual and statistical account of inequality. section 12.6 section 13.5
gini1994 <- filter(gini4, season_end == 1994)
ggplot(gini1994, aes(salary)) +
stat_lorenz(desc = FALSE, color = "red", lwd = 2) +
coord_fixed() +
geom_abline(linetype = "dashed", lwd = 1.5) +
labs(title = "Lorenz Curve\n1993-94 Season",
subtitle = "Gini coefficient = 0.39",
x = "Salary Distribution",
y = "Percentage of NBA Players",
caption = "includes a maximum top 14 salaries for each team") +
scale_x_continuous(labels = percent) +
scale_y_continuous(labels = percent) +
theme(plot.title = element_text(face = "bold"))
Browse executable R code for filtering a season, drawing the curve, formatting percentage axes, and labeling the Gini coefficient. section 12.6
