Quantile-Quantile Plots - Generic Function

DESCRIPTION:

Produces a graphical display to test the distribution of data.

The qqnorm function is generic (see Methods); method functions can be written to handle specific classes of data. Classes that already have methods for this function include:

aov, aovlist, maov.

USAGE:

qqnorm(x, ...) 
qqnorm.default(x, datax = F, plot.it = T, xlab=<<see below>>, 
        ylab=<<see below>>, weights=NULL, freq=NULL, ...) 
qqplot(x, y, plot.it = T) 

REQUIRED ARGUMENTS:

x
a numeric vector or bdNumeric vector for qqplot and qqnorm.default, an object for qqnorm. Missing values (NA) are allowed.
y
numeric vector or bdNumeric vector (not necessarily of the same length as x). Missing values (NA) are allowed.

OPTIONAL ARGUMENTS:

datax
if TRUE, data goes on the x-axis; if FALSE data goes on the y-axis.
plot.it
if FALSE, qqplot.default and qqnorm return a list with components x and y, giving the coordinates of the points that would have been plotted.
xlab, ylab
character strings for axis labels. The default, if datax is TRUE, is the deparsed argument passed as x for the x-axis, and "Quantiles of Standard Normal" for the y-axis. These are switched if datax is FALSE.
weights
in qqnorm.default, a numeric vector the same length as x used to weight the probabilities associated with x.
freq
in qqnorm.default, a numeric vector the same length as x used to replicate the values of x.
...
Graphical parameters may also be supplied as arguments to this function (see ). In particular these functions can take arguments type and log to control plot type and logarithmic axes (see ). Use the arguments xlim and ylim to control the limits of the plot region. In addition, the high-level graphics arguments described under and the arguments to may be supplied to this function.

VALUE:

if plot.it is FALSE, qqplot returns a list with components x and y, giving coordinates of the points that would have been plotted. qqnorm.default always returns such a list.

SIDE EFFECTS:

if plot.it=TRUE, a quantile-quantile plot is produced on the current graphics device.

DETAILS:

In qqplot, each vector or bdVector is taken as a sample, for the x- and y-axis values of an empirical probability plot.

The function qqnorm takes a single vector of data and an optional vector of weights for a normal (Gaussian) probability plot.

BACKGROUND:

QQplots are used to assess whether data have a particular distribution, or whether two datasets have the same distribution. If the distributions are the same, then the plot will be approximately a straight line. The extreme points have more variability than points toward the center. A plot with a "U" shape means that one distribution is skewed relative to the other. An "S" shape implies that one distribution has longer tails than the other. In the default configuration a plot from qqnorm that is bent down on the left and bent up on the right means that the data have longer tails than the Gaussian.

REFERENCES:

Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P. A. (1983). Graphical Methods for Data Analysis. Wadsworth, Belmont, California.

Hoaglin, D. C., Mosteller, F. and Tukey, J. W., editors (1983). Understanding Robust and Exploratory Data Analysis. Wiley, New York.

SEE ALSO:

, , , , , (to create QQplots for other distributions), , , , .

EXAMPLES:

zz <- qqplot(lottery.payoff, lottery3.payoff, plot = F)   
plot(zz)      # plot it 
abline(lmsreg(zz$x, zz$y))  # fit robust line and draw it 
qqnorm(rnorm(length(lottery.payoff)))
                           # evaluate several times to train your eye 
set.seed(493) 
my.sample <- rt(100, 5) 
lab <- "100 observations from a t-distribution with 5 df" 
qqnorm(my.sample, main = lab, sub = "QQ Plot with Line") 
qqline(my.sample)