help cquantile-------------------------------------------------------------------------------

Title

cquantile-- generate corresponding quantiles

Syntax

cquantilevarname1 varname2[if] [in],generate(newvar1 newvar2)

cquantilevarname[if] [in],by(groupvar)generate(newvar1 newvar2)

Description

cquantilegenerates corresponding quantiles, namely, those quantiles that would be shown on a quantile-quantile plot, as in qqplot. Given either two numeric variables, or one numeric variable and one grouping variable defining two groups, two new variables are generated containing the quantiles. One of those new variables contains values identical to those in one of the existing variables or groups, and the other contains corresponding quantiles. The two new variables are aligned lowest to lowest, ..., highest to highest. There is thus some redundancy introduced, but having both variables handy is intended to be a convenience, especially for further graphics. For example, quantile-quantile plots are often inspected for additive or multiplicative structure. A direct way to check for either would be to plot difference of quantiles versus their mean or ratio of quantiles versus their geometric mean.

Options

generate()specifies two new variable names to hold the quantiles.

by()specifies a group variable to specify precisely two groups ofvarname, after anyiforinrestrictions have been noted.by()may be only be specified with a single variable name.

Examples

. cquantile length width, gen(Qlength Qwidth). gen diff = Qlength - Qwidth. gen mean = (Qlength + Qwidth) / 2. scatter diff mean, yti(length - width) xti((length + width)/2)

. cquantile mpg, by(foreign) generate(mpg0 mpg1). qqplot mpg?

AuthorNicholas J. Cox, Durham University n.j.cox@durham.ac.uk

Also seeManual:

[R] diagnostic plotsOnline:

qqplot, separate, fixsort (if installed), pairplot (if installed)