{smcl} {* 12nov2003}{...} {hline} help for {hi:qplot}{right:(STB-51: gr42; STB-61: gr42_1; SJ4-1: gr42_2)} {hline} {title:Quantile plots} {p 8 17 2} {cmd:qplot} {it:plottype} {it:varname} [{cmd:if} {it:exp}] [{cmd:in} {it:range}] [{cmd:,} {cmd:by(}{it:byvar}{cmd:)} {cmdab:miss:ing} {cmd:a(}{it:#}{cmd:)} {cmdab:rank:s} {cmdab:rev:erse} {cmdab:trsc:ale(}{it:transformation_syntax}{cmd:)} {it:graph_options} ] {p 8 17 2} {cmd:qplot} {it:plottype} {it:varlist} [{cmd:if} {it:exp}] [{cmd:in} {it:range}] [{cmd:,} {cmd:a(}{it:#}{cmd:)} {cmdab:rank:s} {cmdab:rev:erse} {cmdab:trsc:ale(}{it:transformation_syntax}{cmd:)} {it:graph_options} ] {title:Description} {p 4 4 2}{cmd:qplot} produces a plot of the ordered values of one or more variables against the so-called plotting positions, which are essentially quantiles of a uniform distribution on [0,1] for the same number of values, or optionally the so-called unique ranks, or optionally a specified transformation of either of those. {p 4 4 2}For {it:n} values of a variable {it:x} ordered so that {p 8 8 2}{it:x}[1] <= {it:x}[2] <= ... <= {it:x}[{it:n}-1] <= {it:x}[{it:n}] {p 4 4 2}the plotting positions are ({it:i} - {it:a}) / ({it:n} - 2{it:a} + 1) for {it:i} = 1, ..., {it:n}. The unique ranks run 1 to {it:n}, tied values being allocated different ranks so that each integer is assigned to a value. {p 4 4 2}For more than one variable in {it:varlist}, only observations with all values of {it:varlist} present are shown. {p 4 4 2}The plot may be one of eight {help graph_twoway:twoway} types, namely, {cmd:area}, {cmd:bar}, {cmd:connected}, {cmd:dot}, {cmd:dropline}, {cmd:line}, {cmd:scatter} or {cmd:spike}. The {it:plottype} must be specified. {title:Options} {p 4 8 2} {cmd:by(}{cmd:)} specifies that calculations are to be carried out separately for each distinct value of a single variable {it:byvar}. {cmd:by()} is only allowed with a single {it:varname}. {p 4 8 2}{cmd:missing}, used only with {cmd:by()}, permits the use of non-missing values of {it:varname} corresponding to missing values for the variable named by {cmd:by()}. The default is to ignore such values. {p 4 8 2}{cmd:a()} specifies {it:a} in the formula for plotting position. The default is {it:a} = 0.5, giving ({it:i} - 0.5) / {it:n}. Other choices include {it:a} = 0, giving {it:i} / ({it:n} + 1), and {it:a} = 1/3, giving ({it:i} - 1/3) / ({it:n} + 1/3). {p 4 8 2}{cmd:ranks} specifies the use of ranks rather than plotting positions. {p 4 8 2}{cmd:reverse} reverses the sort order, so that values decrease from top left. Ordered values are plotted against 1 - plotting position or {it:n} - rank + 1. {p 4 8 2}{cmd:trscale()} specifies the use of an alternative transformed scale for plotting positions (or ranks) on the graph. Stata syntax should be used with {cmd:@} as placeholder for untransformed values. To show percents, specify {cmd:trscale(100 * @)}. To show probabilities on an inverse normal scale, specify {cmd:trscale(invnorm(@))}; on a logit scale, specify {cmd:trscale(logit(@))}; on a folded root scale, specify {cmd:trscale(sqrt(@) - sqrt(1 - @))}; on a loglog scale, specify {cmd:trscale(-log(-log(@)))}; on a cloglog scale, specify {cmd:trscale(log(-log(1 - @)))}. Tools to make associated labels and ticks easier are available on SSC: see {stata ssc desc mylabels:ssc desc mylabels}. {p 4 8 2}{it:graph_options} refers to options of {help graph} appropriate to the {it:plottype} specified. {title:Examples} {p 4 8 2}{inp:. qplot scatter mpg}{p_end} {p 4 8 2}{inp:. qplot line mpg, by(foreign) clp(l _)}{p_end} {p 4 8 2}{inp:. qplot connected length width height}{p_end} {p 4 8 2}{inp:. qplot spike mpg, reverse rank xla(1 10(10)70 74)} {p 4 4 2}To sample all possible {it:plottype}s: {p 4 8 2}{inp:. foreach t in area bar connected dot dropline line scatter spike {c -(}}{p_end} {p 4 8 2}{inp:. {space 8}qplot `t' mpg, by(foreign)}{p_end} {p 4 8 2}{inp:. {c )-}} {p 4 4 2}Some tuning may be desirable, for example:: {p 4 8 2}{inp:. qplot bar mpg, barw(`=1/74') base(0)} {title:Author} Nicholas J. Cox, University of Durham n.j.cox@durham.ac.uk {title:Also see} {p 4 13 2}Online: help for {help graph}, {help cumul}, {help quantile}, {help distplot} (if installed), {help mylabels} (if installed) {p 4 13 2}Manual: {hi:[G] graph}, {hi:[R] cumul}, {hi:[R] diagnostic plots}