Quantile-Quantile Plots With the Ability to Draw Confidence Bands.
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)
Quantiles of x
Quantiles of y
Lower and upper limits if confidence
is specified
A numeric vector of data values.
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).
1-character string giving the type of plot desired.
The x limits.
The y limits.
A label for the x axis.
A label for the y axis.
A main title for the plot.
Color for points and lines.
Line type.
Line width.
Plotting character for points.
Factor for expanding the size of plotted symbols.
Whether or not to draw a plot. if plotting, points outside the confidence bands will be indicated by different a color.
Confidence level for the confidence band, or FALSE
for no band.
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 to an existing plot if true.
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 "...".
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.
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