I am analyzing an ordinate set of text level reading scores. I am using the median and the interquartile range (IQR) for three administrations of the assessment: fall, winter, and spring. I want to accompany the data with boxandwhiskers plots (graph box) and want to indicate what score marks the 25th percentile, the median, and the 75th percentile. The analysis (for 76 elementary schools) is for administrators and teachers. I am flummoxed at labeling the left and right corners of the box and the median. I've tried following the options and using the graph editor. No luck. I am using Stata 12. Any pointers, specific directions?
Announcement
Collapse
No announcement yet.
X

You don't show any code that you tried (see FAQ Advice #12).
On the whole, the more you want to depart from graph box, the more you need a different approach.
Code:stripplot
Code:sysuse auto, clear set scheme s1color egen median = median(mpg), by(foreign) egen loq = pctile(mpg), by(foreign) p(25) egen upq = pctile(mpg) , by(foreign) p(75) gen foreign2 = foreign + 0.1 stripplot mpg, over(foreign) box(barw(0.2)) vertical /// addplot(scatter median loq upq foreign2, ms(none ..) /// mla(median loq upq) mlabcolor(blue ..)) xsc(r(. 1.2)) xla(, noticks)
See also
http://www.statajournal.com/article...article=gr0039
http://www.statajournal.com/article...ticle=gr0039_1
Last edited by Nick Cox; 28 Sep 2016, 16:55.

Here is another variant. I like the quantilebox plots used by Emanuel Parzen. I also made the marker labels a little larger and shifted them away from the boxes.
Code:sysuse auto, clear set scheme s1color egen median = median(mpg), by(foreign) egen loq = pctile(mpg), by(foreign) p(25) egen upq = pctile(mpg) , by(foreign) p(75) gen foreign2 = foreign + 0.15 stripplot mpg, over(foreign) box(barw(0.2)) centre cumul /// cumprob vertical height(0.4) /// addplot(scatter median loq upq foreign2, ms(none ..) /// mla(median loq upq) mlabcolor(blue ..) mlabsize(*1.2 ..)) xsc(r(. 1.2)) xla(, noticks)
Comment

Yet more annotation. Perhaps over the top, but some small tricks are shown. The means are shown in orange and the sample sizes too.
Code:sysuse auto, clear set scheme s1color egen median = median(mpg), by(foreign) egen loq = pctile(mpg), by(foreign) p(25) egen upq = pctile(mpg) , by(foreign) p(75) egen mean = mean(mpg), by(foreign) egen min = min(mpg) egen n = count(mpg), by(foreign) gen shown = "{it:n} = " + string(n) gen foreign2 = foreign + 0.15 gen foreign3 = foreign  0.15 gen showmean = string(mean, "%2.1f") stripplot mpg, over(foreign) box(barw(0.2)) centre cumul /// cumprob vertical height(0.4) /// addplot(scatter median loq upq foreign2, ms(none ..) /// mla(median loq upq) mlabcolor(blue ..) mlabsize(*1.2 ..)  /// scatter mean foreign3, ms(none) mla(showmean) mlabcolor(orange) mlabsize(*1.2) mlabpos(9)  /// scatter min foreign, ms(none) mla(shown) mlabcolor(black) mlabsize(*1.2) mlabpos(6)) /// xsc(r(. 1.2)) xla(, noticks)
Comment
Comment