Dear Statalisters,

I have conceptual and Stata-oriented questions about generating (and later plotting) Gini coefficients alongside 95% confidence intervals. Part 1 is conceptual/statistical, part 2 is more narrowly about Stata syntax.

Part 1:
The tricky part here is that the units between which I want to estimate income inequality are not individuals but aggregates of individuals - regions. I want to know whether inequality between places has risen or fallen over time

Starting from person-level survey microdata, I generate mean incomes for each location, taking into account survey weights. Then I calculate a series of Gini coefficients that track the nature of inter-place income inequality over time. I weight these Ginis by population, as locations differ massively in terms of population.

Initially I was running commands like

Code:
g gini=.
            ineqdeco hw [fw=pop], by(year)
            foreach z in 1940 1950 1960 1970 1980 1990 2000 2010 2019 {
                replace gini=r(gini_`z') if year==`z'
            }
In principle, I know I can use the svylorenz command to get CIs on this estimate. But I'm not sure how to incorporate the survey weight information into the now aggregated dataset (where an observation is a location, not a person). In the command above sampling weights are implicit, in that the means between which I am measuring inequality depend on sampling weights. But how to tell svylorenz about them? And also weight by population?


Part 2:
The less conceptual part is the following. If I can get the right svyset command as far as weights go, how to get svylorenz to place the lower and upper ends of the Gini CI in their own variables?

If I could put the upper and lower bounds in their own variables, as I did with the gini (call the new variables uci and lci), I could then do something like:

Code:
tw (rarea uci lci year , astyle(ci)) /// 
      (connected gini year, mstyle(p1)) ///
   ... etc...

Thanks in advance.
Tom