Skip to Main Content

ATS Stata Plots | Stata FAQ

This page presents examples of graphics programs written by ATS stat
consultants. You can obtain these programs by typing, search command_name,
into the Stata command line and following the instructions (see
How can I use the search command to search for programs and get additional
help?
for more information about using search).

This page contains only the commands and the plots themselves, there is no further explanation.
We envision that users will look through the plots and when they find one that appears
to do what they want, they will download the program and carefully read the help files.

Most of these examples use the hsb2 dataset which can be downloaded from
within Stata using the following command:

use https://stats.idre.ucla.edu/stat/stata/notes3/hsb2, clear

Note: Most of the graphs were produced using the scheme lean1. Whenever a different
scheme is used, it is given in the command.


chidemo — chi-squared distribution with critical value

chidemo 8
Image chidemo1

fdemo — F-distribution with critical value

fdemo 4 32
Image fdemo1

histbox — histgram and boxplot

histbox write, mean start(30) width(5)
Image histbox1

meansdplot — Plot means and standard deviations for groups

meansdplot math prog, outer(2) xlab(1 "gen" 2 "acad" 3 "voc") ytitle(math score)
Image msdp3
egen grp = group(prog female)
meansdplot write grp, outer(2) ///
xlab(1 "m-gen" 2 "f-gen" 3 "m-acad" 4 "f-acad" 5 "m-voc" 6 "f-voc") ytitle(writing score)
Image msdp1
 meansdplot write prog, outer(2) xlab(1 "gen" 2 "acad" 3 "voc") ytitle(writing score) mlabel(female)

Image msdp2

nbvargr — observed variable, poisson & negative binomial probabilities

use https://stats.idre.ucla.edu/stat/stata/notes/lahigh, clear
nbvargr datsabs
Image nbvargr1

postgr3 — post estimation graphs and predicted values

xi3: regress read i.female*socst ses science
postgr3 socst, by(female) scheme(s2mono)
Image postgr3

profileplot — profile plots

profileplot read write math science, by(schtyp)
Image profileplot1
profileplot read write math science if schtyp==2, by(id) msymbol(i) legend(off)
Image profileplot2

tdemo — t-distribution with critical value

tdemo 4
Image tdemo1

zdemo — normal distribution with user selected z-scores

zdemo -1 1
Image zdemo1

zdemo2 — 2 normal distributions with mean and sd

zdemo2 50 5 60 10
Image zdemo2

ztail — normal distribution demonstration

ztail .05 1
Image ztail1
ztail .05 2
Image ztail2