I want to calculate some standard measures of inequality across different regions & store the results in a dataset for further analysis with one observation per region.
statsby seems to be the obvious way to go. There are two user written programs for measuring inequality , ainequal & inequal7 . There are probably others.
It seems like it should be straightforward but I cannot get either to work . I guess I'm doing something dumb.
For example with ainequal (which stores the gini in r(gini_1) )
sysuse auto
. statsby gini = r(gini_1) , by(foreign) saving(myresults1) : ainequal price
(running ainequal on estimation sample)
type mismatch
r(109);
Likewise with inequal7 (which stores the gini as r(gini):
statsby gini = r(gini) , by(foreign) saving(myresults2) : inequal7 price
(running inequal7 on estimation sample)
type mismatch
r(109);
Neither ainequal nor inequal7 is "by"able.
Anyone know a solution to this, whether with statsby or otherwise?
Thanks
Kevin
I use Stata 15.
statsby seems to be the obvious way to go. There are two user written programs for measuring inequality , ainequal & inequal7 . There are probably others.
It seems like it should be straightforward but I cannot get either to work . I guess I'm doing something dumb.

For example with ainequal (which stores the gini in r(gini_1) )
sysuse auto
. statsby gini = r(gini_1) , by(foreign) saving(myresults1) : ainequal price
(running ainequal on estimation sample)
type mismatch
r(109);
Likewise with inequal7 (which stores the gini as r(gini):
statsby gini = r(gini) , by(foreign) saving(myresults2) : inequal7 price
(running inequal7 on estimation sample)
type mismatch
r(109);
Neither ainequal nor inequal7 is "by"able.
Anyone know a solution to this, whether with statsby or otherwise?
Thanks
Kevin
I use Stata 15.
Comment