Description Usage Arguments Details Value Author(s) References See Also Examples
Plots empirical quantiles of a variable, or of studentized residuals from
a linear model, against theoretical quantiles of a comparison distribution. Includes
options not available in the qqnorm
function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  qqPlot(x, ...)
qqp(...)
## Default S3 method:
qqPlot(x, distribution="norm", groups, layout,
ylim=range(x, na.rm=TRUE), ylab=deparse(substitute(x)),
xlab=paste(distribution, "quantiles"), glab=deparse(substitute(groups)),
main=NULL, las=par("las"),
envelope=.95, col=carPalette()[1], col.lines=carPalette()[2],
lwd=2, pch=1, cex=par("cex"),
line=c("quartiles", "robust", "none"), id=TRUE, grid=TRUE, ...)
## S3 method for class 'formula'
qqPlot(formula, data, subset, id=TRUE, ylab, glab, ...)
## S3 method for class 'lm'
qqPlot(x, xlab=paste(distribution, "Quantiles"),
ylab=paste("Studentized Residuals(",
deparse(substitute(x)), ")", sep=""),
main=NULL, distribution=c("t", "norm"),
line=c("robust", "quartiles", "none"), las=par("las"),
simulate=TRUE, envelope=.95, reps=100,
col=carPalette()[1], col.lines=carPalette()[2], lwd=2, pch=1, cex=par("cex"),
id=TRUE, grid=TRUE, ...)

x 
vector of numeric values or 
distribution 
root name of comparison distribution – e.g., 
groups 
an optional factor; if specified, a QQ plot will be drawn for 
layout 
a 2vector with the number of rows and columns for plotting by
groups – for example 
formula 
onesided formula specifying a single variable to be plotted or a twosided formula of
the form 
data 
optional data frame within which to evaluage the formula. 
subset 
optional subset expression to select cases to plot. 
ylim 
limits for vertical axis; defaults to the range of 
ylab 
label for vertical (empirical quantiles) axis. 
xlab 
label for horizontal (comparison quantiles) axis. 
glab 
label for the grouping variable. 
main 
label for plot. 
envelope 
confidence level for pointwise confidence envelope, or

las 
if 
col 
color for points; the default is the first entry
in the current car palette (see 
col.lines 
color for lines; the default is the second entry in the current car palette. 
pch 
plotting character for points; default is 
cex 
factor for expanding the size of plotted symbols; the default is

id 
controls point identification; if 
lwd 
line width; default is 
line 

simulate 
if 
reps 
integer; number of bootstrap replications for confidence envelope. 
... 
arguments such as 
grid 
If TRUE, the default, a lightgray background grid is put on the graph 
Draws theoretical quantilecomparison plots for variables and for studentized residuals from a linear model. A comparison line is drawn on the plot either through the quartiles of the two distributions, or by robust regression.
Any distribution for which quantile and
density functions exist in R (with prefixes q
and d
, respectively) may be used.
When plotting a vector, the confidence envelope is based on the SEs of the order statistics
of an independent random sample from the comparison distribution (see Fox, 2016).
Studentized residuals from linear models are plotted against the appropriate tdistribution with a pointwise
confidence envelope computed by default by a parametric bootstrap,
as described by Atkinson (1985).
The function qqp
is an abbreviation for qqPlot
.
These functions return the labels of identified points, unless a grouping factor is employed,
in which case NULL
is returned invisibly.
John Fox jfox@mcmaster.ca
Fox, J. (2016) Applied Regression Analysis and Generalized Linear Models, Third Edition. Sage.
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
Atkinson, A. C. (1985) Plots, Transformations, and Regression. Oxford.
qqplot
, qqnorm
,
qqline
, showLabels
1 2 3 4 5 6 7 8 9 
Loading required package: carData
[1] 94 57
[1] 94 57
general.managers physicians
2 24
minister machinist
6 28
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.