Box plots have been a standard statistical graph since John W. Tukey and his colleagues and students publicized them energetically in the 1970s. In Stata, graph box and graph hbox are commands available to draw box plots, but sometimes neither is sufficiently flexible for drawing some variations on standard box plot designs. This column explains how to use egen to calculate the statistical ingredients needed for box plots and twoway to re-create the plots themselves. That then allows variations such as adding means, connecting medians, or showing all data points beyond certain quantiles.
BaumC. F.2009. An Introduction to Stata Programming.College Station, TX: Stata Press.
2.
ChenC., HärdleW., and UnwinA., ed. 2008. Handbook of Data Visualization.Berlin: Springer.
3.
ClevelandW. S.1985. The Elements of Graphing Data.Monterey, CA: Wadsworth.
4.
CoxN. J.2002. Speaking Stata: On getting functions to do the work. Stata Journal2: 411–427.
5.
CoxN. J.2004. Stata tip 6: Inserting awkward characters in the plot. Stata Journal4: 95–96.
6.
CoxN. J.2005. Speaking Stata: The protean quantile plot. Stata Journal5: 442–460.
7.
CoxN. J.2006. Stata tip 39: In a list or out? In a range or out?Stata Journal6: 593–595.
8.
CoxN. J.2007. Stata tip 47: Quantile–quantile plots without programming. Stata Journal7: 275–279.
9.
CoxN. J.2009. Speaking Stata: I. J. Good and quasi-Bayes smoothing of categorical frequencies. Stata Journal9: 306–314.
10.
CoxN. J., and JonesK.1981. Exploratory data analysis. In Quantitative Geography: A British View, ed. WrigleyN., and BennettR. J., 135–143. London: Routledge and Kegan Paul.
11.
CroweP. R.1933. The analysis of rainfall probability: A graphical method and its application to European data. Scottish Geographical Magazine49: 73–91.
12.
CuiJ.2007. Stata tip 42: The overlay problem: Offset for clarity. Stata Journal7: 141–142.
13.
De VeauxR. D., VellemanP. F., and BockD. E.2008. Stats: Data and Models. 2nd ed. Boston, MA: Addison–Wesley.
14.
DümbgenL., and RiedwylH.2007. On fences and asymmetry in box-and-whiskers plots. American Statistician61: 356–359.
15.
FreedmanD., PisaniR., and PurvesR.2007. Statistics. 4th ed. New York: W. W. Norton.
16.
FriggeM., HoaglinD. C., and IglewiczB.1989. Some implementations of the boxplot. American Statistician43: 50–54.
17.
HarrisR. L.1999. Information Graphics: A Comprehensive Illustrated Reference.New York: Oxford University Press.
18.
HoaglinD. C., MostellerF., and TukeyJ. W., ed. 1983. Understanding Robust and Exploratory Data Analysis.New York: Wiley.
19.
HyndmanR. J., and FanY.1996. Sample quantiles in statistical packages. American Statistician50: 361–365.
20.
KleinerB., and GraedelT. E.1980. Exploratory data analysis in the geophysical sciences. Reviews of Geophysics18: 699–717.
21.
McGillR., TukeyJ. W., and LarsenW. A.1978. Variations of box plots. American Statistician32: 12–16.
22.
MitchellM.2008. A Visual Guide to Stata Graphics. 2nd ed. College Station, TX: Stata Press.
23.
MonkhouseF. J., and WilkinsonH. R.1971. Maps and Diagrams.London: Methuen.
TukeyJ. W.1972. Some graphic and semigraphic displays. In Statistical Papers in Honor of George W. Snedecor, ed. BancroftT. A., and BrownS. A., 293–316. Ames, IA: Iowa State University Press.
27.
TukeyJ. W.1977. Exploratory Data Analysis.Reading, MA: Addison–Wesley.
28.
VellemanP. F., and HoaglinD. C.1981. Applications, Basics, and Computing of Exploratory Data Analysis.Boston, MA: Duxbury.
29.
WainerH.1990. Graphical visions from William Playfair to John Tukey. Statistical Science5: 340–346.