Yesterday, in the course on inequalities, I mentioned (too) briefly the 3-person Economy. I wanted to spend some time in a short post on visualisations of inequalities in such a context. As mentioned in the slides, it is possible to use a ternary plot representation. In the case where we believe that the scale independence principle makes sense, i.e. . A distribution of incomes can be represented as a barycenter in an equilateral triangle (also called de Finetti diagram). The midpoint is the equal situation: the three agents share the same wealth. Because of the scale independence property, we can look at distribution of wealth on the simplex. A wealth distribution is a vector
where each component is one of the (red) distance below. A is on top of the triangle, and the vertical distance is proportional to the wealth of A. The closer to the bottom line, the poorer A is.
To visualize this distribution of wealth, we can use the trifield package. To add the point and the three segments, the code is
tripoint=function(s){ p=s/sum(s) p1=c(0,s[2]+s[1]/2,s[3]+s[1]/2)/sum(s) p2=c(s[1]+s[2]/2,0,s[3]+s[2]/2)/sum(s) p3=c(s[1]+s[3]/2,s[2]+s[3]/2,0)/sum(s) C <- abc2xy(matrix(p,1,3)) points(C,pch=19,col="red",cex=2) C1 <- abc2xy(matrix(p1,1,3)) C2 <- abc2xy(matrix(p2,1,3)) C3 <- abc2xy(matrix(p3,1,3)) segments(C1[1],C1[2],C[1],C[2],lwd=2,col="red") segments(C2[1],C2[2],C[1],C[2],lwd=2,col="red") segments(C3[1],C3[2],C[1],C[2],lwd=2,col="red") }
For instance, to visualize the equal case (inequality indices are defined as a distance to this situation)
tripoint(c(1,1,1))
For a case where there is inequality, use for instance
tripoint(c(1,2,3))
We’ve seen in the course that there was a natural ordering, based on Lorenz curve. In the case of a 3-person economy, Lorenz curve is juste based on 2 points,
library(ineq) plot(Lc(1:3)) s=cumsum(1:3)/6 points((1:2)/3,s[1:2])
An income distribution is more unequal than distribution
if
for all
. What it means is simply that
and at the same time
For instance, for this distribution of wealth
we have non-ambuigity about the ordering : this new distribution is more unequal
Because it is simple to compare we can use a simple function to compare two distributions
lorenz_dominance=function(s1,s2){ ss1=(cumsum(sort(s1))/sum(s1))[1:2] ss2=(cumsum(sort(s2))/sum(s2))[1:2] dom=0 if(sum(ss1>ss2)==2) dom=1 if(sum(ss1<ss2)==2) dom=-1 return(dom)}
where +1 means more unequal, -1 means less unequal, and 0 means that it is an ambiguous situation, and curves cannot be compared (there is a single crossing here).
Thus, given a reference distribution, it would be nice to visualize all distributions that are more unequal and less unequal. The first step is to get a grid
library(trifield) grid.size = 128 tg = ternary.grid(grid.size)
Then , define function
f = function(x) lorenz_dominance(x,c(1,2,3))
which compares all points with our reference. Then we use some sort of ‘apply’ function, to compute that function on all points of the grid
z = ternary.apply(tg, f)
and then we simply plot the contour plot of that output
tf = ternary.field(tg, z) plot(tf,col=c(rgb(1,0,0,.2),"white",rgb(0,0,1,.2)))
I can add the reference point on the map
tripoint(c(1,2,3))
The output is nice, isn’t? The code here is natural, based on what I would do on a standard cartesian representation… But the output is not valid. And I could not find why… To check, let us draw randomly some incomes, and then plot them
ternary.legend() for(s in 1:50000){ x=rexp(3); x=x/sum(x) points(abc2xy(matrix(x,1,3)),col=c(rgb(1,0,0,.2),"white",rgb(0,0,1,.2))[lorenz_dominance(x,c(1,4,5))+2],pch=19,cex=.7) }
The output is rather different… If my reference is (20,10,1)
ternary.legend() for(s in 1:50000){ x=rexp(3); x=x/sum(x) points(abc2xy(matrix(x,1,3)),col=c(rgb(1,0,0,.2),"white",rgb(0,0,1,.2))[lorenz_dominance(x,c(20,10,1))+2],pch=19,cex=.7) }
which is comparable with a graph one can find is some slides of Economics 1391 (but no reference is mentioned)
I still don’t undertand what went wrong with the initial code…
Actually, we can visualize almost anything, like iso-curves for Gini index. Again, using simulations, I get
for(s in 1:50000){ x=rexp(3); x=x/sum(x); g=Gini(x) points(abc2xy(matrix(x,1,3)),col=heat.colors(100)[round(100*g)],pch=19,cex=.7) }
But this time, if I use functions of the trifield package, it seems to be fine (and consistent with graph one can find in various papers, e.g. in some slides of Economics 1391)
f = function(x) Gini(x) z = ternary.apply(tg, f) tf = ternary.field(tg, z) plot(tf)
And we can visualize iso-inequality curves for any inequality index, for instance Theil index
f = function(x) Theil(x) z = ternary.apply(tg, f) tf = ternary.field(tg, z) plot(tf)
or the generalized entropy,
f = function(x) entropy(x,2) z = ternary.apply(tg, f) tf = ternary.field(tg, z) plot(tf)
That sounds promising, and I believe nice visualizations can be obtained in that 3-person economy, but I still have to understand why the Lorenz-comparison graph did not work…
OpenEdition suggests that you cite this post as follows:
Arthur Charpentier (January 30, 2015). Visualizing Inequalities in a 3-Person Economy. Freakonometrics. Retrieved February 13, 2025 from https://doi.org/10.58079/ouyd