Hello,
I am using Stata v 16.1. I am attempting to create a caterpillar plot (or something of the like) to show the point estimates and SE/SD by 283 groupIDs. My dataset includes 3,501 observations and my primary variable ('outcome') is a binary variable (yes/no). I am first estimating the mean prevalence and SD by groupID. I have run the following commands:
bysort groupID: egen Mean=mean(outcome)
bysort groupID: egen SD=sd(outcome)
Then, I attempted to create a caterpillar plot by using
ssc install caterpillar
caterpillar Mean SD groupID, graph
Below is an example of what I am trying to replicate, followed by my Stata output:


I also attempted to use the statsby command in order to create a standard bar chart with the 95% CIs for each group. I ran the following command
statsby mean=r(mean) sd=r(sd) size=r(N), by(GroupID): summarize outcome
serrbar mean sd GroupID
This is what I wanted:

This is my output graph:

I have 283 distinct groups which I'm trying to show.. so confused by this output. Any help on creating these graphs, or something similar to show point estimates and SDs by group, would be greatly appreciated.
Thank you!
I am using Stata v 16.1. I am attempting to create a caterpillar plot (or something of the like) to show the point estimates and SE/SD by 283 groupIDs. My dataset includes 3,501 observations and my primary variable ('outcome') is a binary variable (yes/no). I am first estimating the mean prevalence and SD by groupID. I have run the following commands:
bysort groupID: egen Mean=mean(outcome)
bysort groupID: egen SD=sd(outcome)
Then, I attempted to create a caterpillar plot by using
ssc install caterpillar
caterpillar Mean SD groupID, graph
Below is an example of what I am trying to replicate, followed by my Stata output:
I also attempted to use the statsby command in order to create a standard bar chart with the 95% CIs for each group. I ran the following command
statsby mean=r(mean) sd=r(sd) size=r(N), by(GroupID): summarize outcome
serrbar mean sd GroupID
This is what I wanted:
This is my output graph:
I have 283 distinct groups which I'm trying to show.. so confused by this output. Any help on creating these graphs, or something similar to show point estimates and SDs by group, would be greatly appreciated.
Thank you!
Comment