liveBook · Manning

Lorenz curve

As explained in Statistics Slam Dunk

A Lorenz curve is a cumulative distribution curve that shows the share of a quantity held by progressively ranked portions of a population.

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

How Statistics Slam Dunk covers it

How deep it goes
Explains axes, ranking, equality comparison, plotting, cleaning, and seasonal comparison without deriving the curve mathematically.
Examples
Uses NBA salary and win-share distributions across 1990–91, 1993–94, 1996–97, and 2016–17 seasons.
What it assumes
Assumes familiarity with R data frames and introduces the required filtering and ggplot2-based plotting steps through examples.
What you can do after
Builds Lorenz curves in R, cleans invalid inputs, and compares inequality using curves and Gini coefficients.
How it connects
Connects cumulative distributions with Gini coefficients, inequality, ggplot2, and data cleaning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.