Shows the Mahalanobis distances based on robust and classical estimates
of the location and the covariance matrix in different plots.
The following plots are available:
index plot of the robust and mahalanobis distances
distance-distance plot
Chisquare QQ-plot of the robust and mahalanobis distances
plot of the tolerance ellipses (robust and classic)
Scree plot - Eigenvalues comparison plot
This function is a minimally modified adaptation of
"robustbase::covPlot". See citation("robustbase").
For the plot() method, a DetMCD object, typically
result of DetMCD.
h.val
An integer in 1:length(DetMCD_object$h) indicating for which
of the values of h the diagnostic plot should be shown.
which
string indicating which plot to show. See the
Details section for a description of the options. Defaults to "all".
.
classic
whether to plot the classical distances too.
Defaults to FALSE.
.
ask
logical indicating if the user should be asked
before each plot, see par(ask=.). Defaults to
which == "all" && dev.interactive().
cutoff
the cutoff value for the distances.
id.n
number of observations to be identified by a label. If
not supplied, the number of observations with distance larger than
cutoff is used.
labels.id
vector of labels, from which the labels for extreme
points will be chosen. NULL uses observation numbers.
cex.id
magnification of point labels.
label.pos
positioning of labels, for the left half and right
half of the graph respectively (used as text(.., pos=*)).
tol
tolerance to be used for computing the inverse, see
solve. Defaults to tol = 1e-7.
...
Further arguments passed to the plot function.
Details
These functions produce several plots based on the robust and classical
location and covariance matrix. Which of them to select is specified
by the attribute which. The plot method for
"mcd" objects is calling covPlot() directly, whereas
covPlot() should also be useful for plotting other (robust)
covariance estimates. The possible options are:
distance
index plot of the robust distances
dd
distance-distance plot
qqchi2
a qq-plot of the robust distances versus the
quantiles of the chi-squared distribution
tolEllipsePlot
a tolerance ellipse plot, via
tolEllipsePlot
screeplot
an eigenvalues comparison plot - screeplot
The Distance-Distance Plot, introduced by
Rousseeuw and van Zomeren (1990), displays the robust distances
versus the classical Mahalanobis distances. The dashed line is the set of
points where the robust distance is equal to the classical distance.
The horizontal and vertical lines are drawn at values equal to the cutoff
which defaults to square root of the 97.5% quantile of a chi-squared
distribution with p degrees of freedom. Points beyond these lines can
be considered outliers.
References
P. J. Rousseeuw and van Zomeren, B. C. (1990).
Unmasking Multivariate Outliers and Leverage Points.
Journal of the American Statistical Association85, 633–639.
P. J. Rousseeuw and K. van Driessen (1999)
A fast algorithm for the minimum covariance determinant estimator.
Technometrics41, 212–223.
See Also
DetMCD
Examples
data(Animals, package ="MASS")
brain <- Animals[c(1:24, 26:25, 27:28),]
detmcd <- DetMCD(log(brain))
plot(detmcd, which = "distance", classic = TRUE)# 2 plots
plot(detmcd, which = "dd")
plot(detmcd, which = "tolEllipsePlot", classic = TRUE)
op <- par(mfrow = c(2,3))
plot(detmcd)## -> which = "all" (5 plots)
par(op)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DetMCD)
Loading required package: robustbase
Loading required package: pcaPP
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DetMCD/plot.DetMCD.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot.DetMCD
> ### Title: Robust Diagnostic Plots For DetMCD
> ### Aliases: plot.DetMCD
> ### Keywords: hplot robust multivariate
>
> ### ** Examples
>
> data(Animals, package ="MASS")
> brain <- Animals[c(1:24, 26:25, 27:28),]
> detmcd <- DetMCD(log(brain))
>
> plot(detmcd, which = "distance", classic = TRUE)# 2 plots
> plot(detmcd, which = "dd")
> plot(detmcd, which = "tolEllipsePlot", classic = TRUE)
> op <- par(mfrow = c(2,3))
> plot(detmcd)## -> which = "all" (5 plots)
> par(op)
>
>
>
>
>
> dev.off()
null device
1
>