EconStatsCraft rigorous, plain-spoken econometrics
Econometrics that explains itself.
Regression, panel data, time series and the whole battery of tests. Every result is followed by a verdict you can defend.
Load a dataset to see it here.
EconStatsCraft › Lorenz curve and Gini
How unevenly something is shared. The curve plots the cumulative share held by the poorest p of the population; the Gini is twice the area between that curve and the 45-degree line of perfect equality. Computed from the points that are drawn, so the number and the picture cannot disagree.
Sort everyone from poorest to richest and plot the cumulative share of people against the cumulative share of income. Perfect equality is the 45-degree line: the poorest 30% would hold 30% of the income. Real distributions sag below it, and the Gini coefficient is simply how much area lies in that sag, doubled so it runs from 0 to 1. One number for the whole curve - which is its convenience and its central weakness.
For any question about how unevenly something is shared: income, wealth, land, firm size, emissions, market share. Also as a summary of concentration in industrial organisation, where the same curve is read as market share by firm.
With incomes sorted x_{(1)}\le\dots\le x_{(n)}, the Lorenz curve joins the points \left(\frac{k}{n},\ \frac{\sum_{i\le k}x_{(i)}}{\sum_i x_i}\right). The Gini is twice the area between that curve and the diagonal, and has several equivalent forms. The most revealing is the mean absolute difference form, G=\frac{\sum_i\sum_j|x_i-x_j|}{2n^2\bar{x}}, which says the Gini is the average absolute income gap between two randomly chosen people, expressed as a share of twice the mean. The computational form used here is G=\frac{2\sum_i i\,x_{(i)}}{n\sum_i x_i}-\frac{n+1}{n}, which is one pass after sorting.
G=1-2\int_0^1 L(p)\,dp\qquad L(p)=\frac{\sum_{i\le p}y_i}{\sum_i y_i}
On the wage sample the Gini is 0.2542 - low by international standards, which is what a single occupation-and-schooling dataset looks like rather than a national income distribution. Then the warning that the number alone cannot give you. Take the two small distributions [1,1,1,1,6] and [1,1,2,7,7]: both return a Gini of 0.4000, and they are not remotely the same society. One is four identical people and a single rich outlier; the other has two rich, one in the middle and two poor. Any policy aimed at the first would miss the second entirely. The Gini is a single summary of an entire curve, and every single summary of a curve has a family of distributions that share it - which is why the Lorenz curve is drawn beside the coefficient rather than under it, and why a change in the Gini over time should always be read off the two curves before it is explained.
| If you see this | It means | Do this |
|---|---|---|
| Gini above 0.9 | Near-total concentration, or a data error | Check for a single enormous value |
| Gini near zero on real income data | Almost certainly the wrong variable | Real income Ginis run roughly 0.25 to 0.65 |
| Negative incomes present | The Lorenz curve is not defined | Losses break the cumulative share; exclude or bottom-code them |
| Two groups, same Gini, different curves | The curves cross | They cannot be ranked. Show both curves |
| Gini barely moving after a large transfer | It was in a tail | Use top shares or Theil for tail-sensitive questions |
| Small sample | The maximum is 1 - 1/n | Apply the n/(n-1) correction |
Descriptive statistics, for the distribution the curve summarises. Aggregate, for the group-level version and its hazards.
Line chart · Area chart · Bar chart · Stacked bar · Scatter plot · Bubble chart · Histogram · Box plot · Pie chart · Heat map · Rebased to 100
Line chart · Area chart · Bar chart · Stacked bar · Scatter plot · Bubble chart · Histogram · Box plot · Pie chart · Heat map · Rebased to 100 · Lorenz curve and Gini
World map · Bivariate map · Flow map · India - state map · India - district map
Descriptive statistics · Summary by group · Two-way table · Classical statistical tests
Multiple regression (OLS) · Logit / Probit · Tobit (censored) · Truncated regression · Multinomial logit · Ordered logit / probit · Quantile regression · Poisson / Negative binomial
Time-varying coefficients (Kalman) · Unit root tests · Correlogram (ACF / PACF) · ARIMA / SARIMA · Rolling-origin cross-validation · Theta method · Unobserved components · STL forecasting · Forecast combination · Markov regime switching · Change frequency (resample) · ARCH / GARCH volatility · Decompose & filter · Spectral analysis · Exponential smoothing · Forecast accuracy
Yield curve (Nelson–Siegel / Svensson) · Dynamic factor model · Dynamic regression (ARIMAX) · Structural VAR · VAR · Granger causality · Cointegration · VECM · ARDL & bounds test
Panel regression · Panel cointegration tests · Heterogeneous panel: Mean Group & PMG · Gravity model of trade · Dynamic panel GMM · Panel diagnostics · Panel unit-root tests
Principal components (PCA) · Factor analysis · Cluster analysis
Conjoint analysis · MaxDiff (best–worst scaling) · TURF - reach of a product line · Price sensitivity (Van Westendorp) · Market basket analysis · Perceptual map · Scale reliability (Cronbach’s alpha) · Key driver analysis
Spatial autocorrelation · Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition
Black–Scholes option pricing · Bond price, duration & convexity · Merton distance to default · EMI / home loan planner · CAPM / beta estimation · Multi-factor model · Portfolio optimization · Value at Risk & Expected Shortfall · Performance & drawdown · Time value of money & NPV/IRR · Equity valuation (DDM, FCF, residual income) · Cost of capital (WACC) · Binomial option pricing · Option strategies (payoff & profit) · Forwards, futures & swaps · Credit risk & Basel capital · Extreme value theory (tail risk)
Life table · Life annuity · Life insurance pricing · Chain ladder reserving · Buhlmann credibility · Survival analysis · Mortality graduation · Aggregate loss model · Ruin probability · Multi-state Markov model · Loss severity fitting
Monte Carlo experiment · F-test, Wald & Chow · Structural breaks & stability
Regression vs machine learning · Ridge / Lasso / Elastic Net · Random forest · Gradient boosting
EconStatsCraft rigorous, plain-spoken econometrics
Regression, panel data, time series and the whole battery of tests. Every result is followed by a verdict you can defend.
Load a dataset to see it here.
Pick the example closest to your question. You get a spreadsheet with the right columns and a few rows showing the expected format - replace the numbers with your own, then paste or upload it back.
Copy the header row from the table above (or from the downloaded template), put your own rows underneath, and paste the whole thing here. It is checked against the layout before anything is imported.
Or click a row in the preview below.
For a units or notes row.
Search every source at once. World Bank indicators need countries and years; everything else loads in one click.
Loading the catalogue…
The engine stays loaded, so this is quick - and it leaves your open tab and panel layout alone.
⌘/Ctrl+Enter runs the current analysis. ⌘/Ctrl+P exports the session as a PDF. Esc closes this.
In the Notebook: Enter starts a new block and
Shift+Enter a new line inside one; Backspace at the start
joins back into the paragraph above; / on an empty line inserts anything.
⌘/Ctrl+B, I, E, H and
M apply bold, italic, code, highlight and maths.
#, ##, -, 1., > and
``` at the start of a line convert it.
Sign in to run unlimited analyses.
Scroll to pan · Esc to close