A chi square quantile-quantile plots show the relationship between data-based values which should be distributed as χ2 and corresponding quantiles from the χ2 distribution. In multivariate analyses, this is often used both to assess multivariate normality and check for outliers, using the Mahalanobis squared distances (D2) of observations from the centroid.
x: either a numeric data frame or matrix for the default method, or an object of class "mlm" representing a multivariate linear model. In the latter case, residuals from the model are plotted.
...: Other arguments passed to methods
method: estimation method used for center and covariance, one of: "classical" (product-moment), "mcd" (minimum covariance determinant), or "mve" (minimum volume ellipsoid).
detrend: logical; if FALSE, the plot shows values of D2
vs. χ2. if TRUE, the ordinate shows values of c("D2−\n", "chi2")
pch: plot symbol for points. Can be a vector of length equal to the number of rows in x.
col: color for points. Can be a vector of length equal to the number of rows in x. The default is the first entry in the current color palette (see palette and par.
cex: character symbol size for points. Can be a vector of length equal to the number of rows in x.
ref.col: Color for the reference line
ref.lwd: Line width for the reference line
conf: confidence coverage for the approximate confidence envelope
env.col: line color for the boundary of the confidence envelope
env.lwd: line width for the confidence envelope
env.lty: line type for the confidence envelope
env.fill: logical; should the confidence envelope be filled?
fill.alpha: transparency value for fill.color
fill.color: color used to fill the confidence envelope
labels: vector of text strings to be used to identify points, defaults to rownames(x) or observation numbers if rownames(x) is NULL
id.n: number of points labeled. If id.n=0, the default, no point identification occurs.
id.method: point identification method. The default id.method="y" will identify the id.n points with the largest value of abs(y-mean(y)). See showLabels for other options.
id.cex: size of text for point labels
id.col: color for point labels
xlab: label for horizontal (theoretical quantiles) axis
ylab: label for vertical (empirical quantiles) axis
main: plot title
what: the name of the object plotted; used in the construction of main when that is not specified.
ylim: limits for vertical axis. If not specified, the range of the confidence envelope is used.
Returns
Returns invisibly the vector of squared Mahalanobis distances corresponding to the rows of x or the residuals of the model for the identified points, else NULL
Details
cqplot is a more general version of similar functions in other packages that produce chi square QQ plots. It allows for classical Mahalanobis squared distances as well as robust estimates based on the MVE and MCD; it provides an approximate confidence (concentration) envelope around the line of unit slope, a detrended version, where the reference line is horizontal, the ability to identify or label unusual points, and other graphical features.
The method for "mlm" objects applies this to the residuals from the model.
The calculation of the confidence envelope follows that used in the SAS program, http://www.datavis.ca/sasmac/cqplot.html which comes from Chambers et al. (1983), Section 6.8.
The essential formula is
SE(z(i))=δ^/g(qi))×pi(1−pi)/n
where z(i) is the i-th order value of D2, δ^ is an estimate of the slope of the reference line obtained from the corresponding quartiles and g(qi) is the density of the chi square distribution at the quantile qi.
Note that this confidence envelope applies only to the D2 computed using the classical estimates of location and scatter. The car::qqPlot() function provides for simulated envelopes, but only for a univariate measure. Oldford (2016) provides a general theory and methods for QQ plots.