Learn R Programming

QTLRel (version 1.14)

qqPlot: Quantile-Quantile Plots

Description

Quantile-Quantile Plots With the Ability to Draw Confidence Bands.

Usage

qqPlot(y, x = "norm", ...,
   type = "p", xlim = NULL, ylim = NULL,
   xlab = if(is.numeric(x)) deparse(substitute(x)) else x,
   ylab = deparse(substitute(y)),main="Q-Q Plot",
   col = 1, lty = 2, lwd = 1, pch = 1, cex = 0.7, plot.it = TRUE,
   confidence = .95, qqline = c("observed","expected","none"),
   add = FALSE)

Value

x

Quantiles of x

y

Quantiles of y

lower, upper

Lower and upper limits if confidence is specified

Arguments

y

A numeric vector of data values.

x

Either a numeric vector of data values, or a character string naming a distribution function such as "norm".

...

Parameters passed to the distribution specified by x (if non-numerical).

type

1-character string giving the type of plot desired.

xlim

The x limits.

ylim

The y limits.

xlab

A label for the x axis.

ylab

A label for the y axis.

main

A main title for the plot.

col

Color for points and lines.

lty

Line type.

lwd

Line width.

pch

Plotting character for points.

cex

Factor for expanding the size of plotted symbols.

plot.it

Whether or not to draw a plot. if plotting, points outside the confidence bands will be indicated by different a color.

confidence

Confidence level for the confidence band, or FALSE for no band.

qqline

Whether or not to draw a reference line. if "observed", the line passes through the first and third observed quartiles; if "expected", the point (x,y) is expected to fall on the line if x and y follow the same distribution; if "none", no reference line is drawn.

add

Add to an existing plot if true.

Details

If x is numeric, a two-sample test of the null hypothesis that x and y were drawn from the same continuous distribution is performed. Alternatively, x can be a character string naming a continuous distribution function. In such a case, a one-sample test is carried out of the null that y was draw from distribution x with parameters specified by "...".

References

George Marsaglia, Wai Wan Tsang and Jingbo Wang (2003), Evaluating Kolmogorov's distribution. Journal of Statistical Software 8 (18): 1-4.

Vijayan N. Nair (1982). Q-Q plots with confidence bands for comparing several populations.

William J. Conover (1971). Practical Nonparametric Statistics. New York: John Wiley & Sons.

See Also

Examples

Run this code
if (FALSE) {
par(mfrow=c(1,2))
x<- rnorm(200, mean=0.7,sd=2); y<- rnorm(200, sd=2)
qqPlot(y,x,qqline="exp")
qqPlot(y=y,x="norm",sd=2)
ks.test(x,y)
}

Run the code above in your browser using DataLab