Using
clear
score group test
2 0 A
3 0 B
6 0 B
8 0 A
2 0 A
2 0 A
10 1 B
7 1 B
8 1 A
5 1 A
10 1 A
11 1 B
end
I want to scatter plot mean score
by group
for each test
(same graph) with confidence intervals (the real data has thousands of observations). The resulting graph would have two sets of two dots. One set of dots for test==a
(group==0
vs group==1
) and one set of dots for test==b
(group==0
vs group==1
).
My current approach works but it is laborious. I compute all of the needed statistics using egen
: the mean, number of observations, standard deviations...for each group by test. I then collapse
the data and plot.
There has to be another way, no?
I assumed that Stata would be able to take as its input the score
group
and test
variables and then compute and present this pretty standard graph.
After spending a lot of time on Google, I had to ask.