car (version 1.0-10)

qq.plot: Quantile-Comparison Plots

Description

Plots empirical quantiles of a variable, or of studentized residuals from a linear model, against theoretical quantiles of a comparison distribution.

Usage

qq.plot(x, ...)

qqp(...)

qq.plot.default(x, distribution="norm", 
  ylab=deparse(substitute(x)), 
  xlab=paste(distribution, "quantiles"), main="", las=par('las'),
  envelope=0.95, labels=FALSE, col=palette()[2], lwd=2, pch=1,
  line=c("quartiles", "robust", "none"), ...)

qq.plot.lm(x, main="", xlab=paste(distribution, "Quantiles"), 
  ylab=paste("Studentized Residuals(", deparse(substitute(x)), ")",
    sep = ""), 
  distribution=c("t", "norm"), line=c("quartiles", "robust", "none"), 
  las=par('las'), simulate=FALSE, envelope=0.95, labels=names(rstudent), 
  reps=100, col=palette()[2], lwd=2, pch=1, ...)

Arguments

x
vector of numeric values or lm object.
distribution
root name of comparison distribution -- e.g., norm for the normal distribution; t for the t-distribution.
ylab
label for vertical (empirical quantiles) axis.
xlab
label for horizontal (comparison quantiles) axis.
main
label for plot.
envelope
confidence level for point-wise confidence envelope, or FALSE for no envelope.
labels
vector of point labels for interactive point identification, or FALSE for no labels.
las
if 0, ticks labels are drawn parallel to the axis; set to 1 for horizontal labels (see par).
col
color for points and lines; the default is the second entry in the current color palette (see palette and par).
pch
plotting character for points; default is 1 (a circle, see par).
lwd
line width; default is 2 (see par). Confidence envelopes are drawn at half this line width.
line
"quartiles" to pass a line through the quartile-pairs, or "robust" for a robust-regression line; the latter uses the rlm function in the MASS package. Specifying line = "none" supp
simulate
if TRUE calculate confidence envelope by parametric bookstrap; for lm object only. The method is due to Atkinson (1985).
reps
integer; number of bootstrap replications for confidence envelope.
...
arguments such as df to be passed to the appropriate quantile function.

Value

  • NULL. These functions are used only for their side effect (to make a graph).

Details

Draws theoretical quantile-comparison 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. Studentized residuals are plotted against the appropriate t-distribution. The function qqp is an abbreviation for qq.plot.

References

Fox, J. (1997) Applied Regression, Linear Models, and Related Methods. Sage. Atkinson, A. C. (1985) Plots, Transformations, and Regression. Oxford.

See Also

qqplot, qqnorm, qqline

Examples

Run this code
x<-rchisq(100, df=2)
qq.plot(x)
qq.plot(x, dist="chisq", df=2)

data(Ornstein)
mod<-lm(interlocks~assets+sector+nation, data=Ornstein)
qq.plot(mod, sim=TRUE)

Run the code above in your browser using DataCamp Workspace