I'm performing decomposition analysis of socioeconomic inequality of health, and have gotten the code down, generally following the World Bank procedure. Here's the relevant part of my code.
foreach x of global X {
qui {
sca b_`x' = _b[`x']
corr rank `x' [aw=newweight], c
sca cov_`x' = r(cov_12)
sum `x' [aw=newweight]
sca elas_`x' = (b_`x'*r(mean))/avg
sca CI_`x' = 2*cov_`x'/r(mean)
sca con_`x' = elas_`x'*CI_`x'
sca prcnt_`x' = con_`x'/c
}
di "`x' elasticity:", elas_`x'
di "`x' concentration index:", CI_`x'
di "`x' contribution:", con_`x'
di "`x' percentage contribution:", prcnt_`x'
}
Now, what I want is these final four estimates to be able to be displayed for all of my variables x in X, similar to four regression tables appended together with their coefficients. I am struggling to find how to properly "save" these estimates and call them up in esttab
, tabout
, table
, etc. I merely display the original regression coefficients.