Learn R Programming

extRemes (version 2.2)

qqplot: qq-plot Between Two Vectors of Data with 95 Percent Confidence Bands

Description

QQ-plot between two data vectors with 95 percent confidence bands based on the Kolmogorov-Smirnov statistic (Doksum and Sievers, 1976).

Usage

qqplot(x, y, pch = 20, xlab = "x Quantiles", ylab = "y Quantiles", regress = TRUE,
    make.plot = TRUE, ...)

# S3 method for qqplot plot(x, ...)

# S3 method for qqplot summary(object, ...)

Value

An object of class “qqplot” is invisibly returned by each function (in the case of the method functions, the object entered is simply returned invisibly). This is a list object with components:

call

calling string

names

list object with components x and y giving the object names for the objects passed into x and y, resp.

regression

If regress was TRUE, then this is the fitted regression object as returned by lm. Otherwise, this component is not included.

qdata

data frame with components: x and y giving the quantiles for x and y, resp., and lower and upper giving the lower and upper 95 percent confidence bands, resp.

Arguments

x

qqplot: numeric vector of length 'm' giving one data set.

plot method function: list object of class “qqplot” returned by qqplot.

object

list object of class “qqplot” returned by qqplot.

y

numeric vector of length 'n' giving the other data set.

pch

Plot character.

xlab

Character string giving the label for the abscissa axis.

ylab

Character string giving the label for the ordinate axis.

regress

logical, should a regression line be fit to the quantiles?

make.plot

logical, should the plot be created (TRUE) or not (FALSE)?

...

Other optional arguments to the plot function. Not used by summary method function.

Author

Peter Guttorp, peter “at” stat.washington.edu

Details

Plots the sorted (missing-values removed) 'x' values against the sorted, and interpolated (via the approxfun function from package stats), 'y' values. Confidence bands are about the sorted and interpolated 'y' values using +/- K/sqrt(M), where

K = 1.36

and

M = m*n / (m+n).

The plot method function does exactly the same thing as qqplot except that it does not need to do any calculations.

The summary method function merely displays the original call to the function unless a regression line was fit between the quantiles, in which case summary information is displayed for the regression (i.e., the summary method function for lm is run on the “lm” object).

References

Doksum, K.A. and G.L. Sievers, 1976. Plotting with confidence: graphical comparisons of two populations. Biometrika, 63 (3), 421--434.

See Also

approxfun, qqnorm, shiftplot

Examples

Run this code
z <- rnorm(100)
y <- rexp(100)
qqplot( z, y)
qqplot( y, z)

data( ftcanmax)
qqplot( ftcanmax[,"Prec"], z)
obj <- qqplot( ftcanmax[,"Prec"], y, make.plot=FALSE)
plot(obj)
summary(obj)

Run the code above in your browser using DataLab