cov.rob.
Provisions are provided to do this for more than two variables,
in a scatterplot matrix format.covEllipses(x, ...)
## S3 method for class 'boxM':
covEllipses(x, ...)
## S3 method for class 'data.frame':
covEllipses(x, group, pooled = TRUE, method = c("classical", "mve", "mcd"), ...)
## S3 method for class 'matrix':
covEllipses(x, group, pooled = TRUE, method = c("classical", "mve", "mcd"), ...)
## S3 method for class 'default':
covEllipses(x, means, df,
labels = NULL, variables = 1:2, level = 0.68,
segments = 60,
center = FALSE, center.pch = "+", center.cex = 2,
col = getOption("heplot.colors", c("red", "blue", "black", "darkgreen",
"darkcyan", "brown", "magenta", "darkgray")),
lty = 1, lwd = 2,
fill = FALSE, fill.alpha = 0.3,
label.pos = 0,
xlab, ylab,
vlabels, var.cex=2,
main = "",
xlim, ylim, axes = TRUE,
offset.axes, add = FALSE, ...)data.frame and matrix methods, this is a numeric matrix of two or more columns
supplying the variables to be analyzed.n=nrow(x) doing the same.
If missing, a single covariance ellipse is drawn.TRUE, the pooled covariance matrix for the total sample is also computed and plotted"classical"),
or minimum volume ellipsoid ("mve"), or
minimum covariance determinant ("mcd").pooled=TRUE).
Rows are the groups, and columns are the variables. It is assumed that the means have
column names corresponding to the variables inTRUE,
indicating that group labels are taken as the names of the covariance matrices.
Use labels="" to suppress group labels, e.g., when add=TRUE1:2. If more than two variables are supplied, the function
plots all pairwise covariance ellipses in a scatterplot matrix format.0.68.40.TRUE, the covariance ellipses are centered at the centroid."+".2.2:1.1:2.[0,1], where 0 means fully transparent and 1 means fully opaque. Defaults to 0.3.0:4) or character strings
(in c("center", "bottom", "left", "top", "right")) use in labeling ellipses,
recycled as necessary.
Values of 1, 2, 3 and 4, respectively indicate positionslength(variables) > 2."", and presently has no effect.TRUETRUE, add to the current plot; the default is FALSE. This argument is has no effect
when more than two variables are plotted.plot, text,
and pointsheplot,
boxM,
cov.robdata(iris)
# compare classical and robust covariance estimates
covEllipses(iris[,1:4], iris$Species)
covEllipses(iris[,1:4], iris$Species, fill=TRUE, method="mve", add=TRUE, labels="")
# method for a boxM object
x <- boxM(iris[, 1:4], iris[, "Species"])
x
covEllipses(x, fill=c(rep(FALSE,3), TRUE) )
covEllipses(x, fill=c(rep(FALSE,3), TRUE), center=TRUE, label.pos=1:4 )
# method for a list of covariance matrices
cov <- c(x$cov, pooled=list(x$pooled))
df <- c(table(iris$Species)-1, nrow(iris)-3)
covEllipses(cov, x$means, df, label.pos=3, fill=c(rep(FALSE,3), TRUE))
covEllipses(cov, x$means, df, label.pos=3, fill=c(rep(FALSE,3), TRUE), center=TRUE)
# scatterplot matrix version
covEllipses(iris[,1:4], iris$Species,
fill=c(rep(FALSE,3), TRUE), variables=1:4,
fill.alpha=.1)Run the code above in your browser using DataLab