Dear Statalisters,
Hope this message finds your summer well. I am writing regarding a graphing issue that I have with Stata. I ran this series of logit models for about 60 countries and wanted to graph the regression coefficients and their associated confidence intervals of a particular predictor for all these countries. In the envisaged graph, the x-axis corresponds to the coefficients and the y-axis for the country variable (value-labeled). I'd also like the coefficients graphed in an ascending/descending order based on their magnitude. I have these coefficients and their confidence intervals collected in a new data file, along with their corresponding country codes. So the four variables in this new country data file include country (value-labeled), coefmean (reg coefficient estimates), coefhi (high end for the 95% CI), and coeflo (low end for the 95% CI). I tried several Stata graphing commands and code chunks, but none of these worked, as expected
Frankly, they don't look right to me to begin with.
For example, the following line is fine with ordering the coefficients and correctly showing country labels, but it doesn't accommodate confidence intervals

I also tried the following code snippet
I got the following graph.

This graph presents the reg coefficient estimates and associated confidence intervals nicely, but doesn't have country labels. Any help/pointer would be very much appreciated.
Jun Xu, PhD
Professor
Department of Sociology
University of Macau
Hope this message finds your summer well. I am writing regarding a graphing issue that I have with Stata. I ran this series of logit models for about 60 countries and wanted to graph the regression coefficients and their associated confidence intervals of a particular predictor for all these countries. In the envisaged graph, the x-axis corresponds to the coefficients and the y-axis for the country variable (value-labeled). I'd also like the coefficients graphed in an ascending/descending order based on their magnitude. I have these coefficients and their confidence intervals collected in a new data file, along with their corresponding country codes. So the four variables in this new country data file include country (value-labeled), coefmean (reg coefficient estimates), coefhi (high end for the 95% CI), and coeflo (low end for the 95% CI). I tried several Stata graphing commands and code chunks, but none of these worked, as expected

For example, the following line is fine with ordering the coefficients and correctly showing country labels, but it doesn't accommodate confidence intervals
Code:
graph hbar coefmean, over(country, sort(1) descending label(labsize(*0.40)))
I also tried the following code snippet
Code:
gsort -coefmean gen rank = _n twoway (scatter rank coefmean, mcolor(navy)) /// (rcap coefhi coeflo rank, horizontal lcolor(black))
This graph presents the reg coefficient estimates and associated confidence intervals nicely, but doesn't have country labels. Any help/pointer would be very much appreciated.
Jun Xu, PhD
Professor
Department of Sociology
University of Macau
Comment