Hi all
I have a categorical variable that is centered around zero and is somewhat normal-looking (bell shaped). I want to summarize the distribution and a bar graph seems natural. However, it would also be nice to also show the % of the sample that falls within X bars/units away from the center. Similar to how with an actual normal graph, we know for example that 95% is within +-1.963. One can think of this as a second set of (wider) bins, or I suppose another set of groups.
The code to produce an example is below. I used the auto data to create a new variable headroom0 centered around zero. I then use Microsoft paint to create the picture attached below. The feature I am looking for is the addition of the "bins"/brackets I have added in paint (at bottom), or another feature that achieves the same thing visually, on the same graph. Any ideas?
The bottom line for my analysis is the overall statistic for each sub-sample (which would be the 87.84% from the example below) that is within an acceptable range. In this case I find that the a statistic alone can be a bit abstract, so it can help the narrative of a piece if one ties it to a visual.

Update: I can't for the life of me figure out how to get this picture to upload at a reasonable size.
Regards,
Bruce
I have a categorical variable that is centered around zero and is somewhat normal-looking (bell shaped). I want to summarize the distribution and a bar graph seems natural. However, it would also be nice to also show the % of the sample that falls within X bars/units away from the center. Similar to how with an actual normal graph, we know for example that 95% is within +-1.963. One can think of this as a second set of (wider) bins, or I suppose another set of groups.
The code to produce an example is below. I used the auto data to create a new variable headroom0 centered around zero. I then use Microsoft paint to create the picture attached below. The feature I am looking for is the addition of the "bins"/brackets I have added in paint (at bottom), or another feature that achieves the same thing visually, on the same graph. Any ideas?
The bottom line for my analysis is the overall statistic for each sub-sample (which would be the 87.84% from the example below) that is within an acceptable range. In this case I find that the a statistic alone can be a bit abstract, so it can help the narrative of a piece if one ties it to a visual.
Code:
sysuse auto,clear su headroom gen headroom0=round(headroom-`r(mean)',0.5) graph bar, over(headroom0) title(distribution of headroom0) ytitle(proportion of sample) b1title(value of headroom)
Update: I can't for the life of me figure out how to get this picture to upload at a reasonable size.
Regards,
Bruce
Comment