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.cqplot(x, ...)
## S3 method for class 'mlm':
cqplot(x, ...)
## S3 method for class 'default':
cqplot(x, method = c("classical", "mcd", "mve"),
detrend = FALSE, pch = 19, col = palette()[1],
ref.col = "red", ref.lwd = 2,
conf = 0.95, env.col = "gray", env.lwd = 2, env.lty = 1,
env.fill = TRUE, fill.alpha = 0.2,
fill.color = trans.colors(ref.col, fill.alpha),
labels = if (!is.null(rownames(x))) rownames(x) else 1:nrow(x),
id.n, id.method = "y", id.cex = 1, id.col = palette()[1],
xlab, ylab, main, what=deparse(substitute(x)), ylim, ...)"mlm" representing a multivariate linear model.
In the latter case, residuals from the model are plotted."classical" (product-moment),
"mcd" (minimum covariance determinant), or
"mve" (minimum volume ellipsoid).FALSE, the plot shows values of $D^2$ vs. $\chi^2$.
if TRUE, the ordinate shows values of $D^2 - \chi^2$fill.colorrownames(x) or observation numbers if rownames(x) is NULLid.n=0, the default, no point identification occurs.id.method="y" will identify the id.n points
with the largest value of abs(y-mean(y)). See showLabels for other options.main
when that is not specified.x
or the residuals of the model.Mahalanobis for calculation of Mahalanobis squared distance
qqplot,
qqPlot can give a similar result for Mahalanobis squared distances
of data or residuals.cqplot(iris[, 1:4])
iris.mod <- lm(as.matrix(iris[,1:4]) ~ Species, data=iris)
cqplot(iris.mod, id.n=3)
# compare with car::qqPlot
car::qqPlot(Mahalanobis(iris[, 1:4]), dist="chisq", df=4, id.n=3)Run the code above in your browser using DataLab