I'm working with BigQuery, and I'm interested in plotting a Lorenz curve (for inequality, related to the Gini coefficient).
How can I produce the data for a plot like this with SQL?
The curve is a graph showing the proportion of overall income or wealth assumed by the bottom x% of the people, although this is not rigorously true for a finite population (see below). It is often used to represent income distribution, where it shows for the bottom x% of households, what percentage (y%) of the total income they have. The percentage of households is plotted on the x-axis, the percentage of income on the y-axis. It can also be used to show distribution of assets. In such use, many economists consider it to be a measure of social inequality. https://en.wikipedia.org/wiki/Lorenz_curve