compute.bagplot() computes an object describing a bagplot
of a bivariate data set. plot.bagplot() plots a bagplot object.
bagplot() computes and plots a bagplot.
x values of a data set;
in bagplot: an object of class bagplot
computed by compute.bagplot
y
y values of the data set
factor
factor defining the loop
na.rm
if TRUE 'NA' values are removed otherwise exchanged by median
approx.limit
if the number of data points exceeds
approx.limit a sample is used to compute
some of the quantities; default: 300
show.outlier
if TRUE outlier are shown
show.whiskers
if TRUE whiskers are shown
show.looppoints
if TRUE loop points are plottet
show.bagpoints
if TRUE bag points are plottet
show.loophull
if TRUE the loop is plotted
show.baghull
if TRUE the bag is plotted
create.plot
if FALSE no plot is created
add
if TRUE the bagplot is added to an existing plot
pch
sets the plotting character
cex
sets characters size
dkmethod
1 or 2, there are two method of
approximating the bag, method 1 is very rough (only based on observations
precision
precision of approximation, default: 1
verbose
automatic commenting of calculations
debug.plots
if TRUE additional plots describing
intermediate results are constructed
col.loophull
color of loop hull
col.looppoints
color of the points of the loop
col.baghull
color of bag hull
col.bagpoints
color of the points of the bag
transparency
see section details
...
additional graphical parameters
Details
A bagplot is a bivariate generalization of the well known
boxplot. It has been proposed by Rousseeuw, Ruts, and Tukey.
In the bivariate case the box of the boxplot changes to a
convex polygon, the bag of bagplot. In the bag are 50 percent
of all points. The fence separates points within the fence from
points outside. It is computed by increasing the
the bag. The loop is defined as the convex hull containing
all points inside the fence.
If all points are on a straight line you get a classical
boxplot.
bagplot() plots bagplots that are very similar
to the one described in Rousseeuw et al.
Remarks:
The two dimensional median is approximated.
For large data sets the error will be very small.
On the other hand it is not very wise to make a (graphical)
summary of e.g. 10 bivariate data points.
In case you want to plot multiple (overlapping) bagplots,
you may want plots that are semi-transparent. For this
you can use the transparency flag.
If transparency==TRUE the alpha layer is set to '99' (hex).
This causes the bagplots to appear semi-transparent,
but ONLY if the output device is PDF and opened using:
pdf(file="filename.pdf", version="1.4").
For this reason, the default is transparency==FALSE.
This feature as well as the arguments
to specify different colors has been proposed by Wouter Meuleman.
Value
compute.bagplot returns an object of class
bagplot that could be plotted by
plot.bagplot().
An object of the bagplot class is a list with the following
elements: center is a two dimensional vector with
the coordinates of the center. hull.center is a
two column matrix, the rows are the coordinates of the
corners of the center region. hull.bag and
hull.loop contain the coordinates of the hull of the bag
and the hull of the loop. pxy.bag shows you the
coordinates of the points of the bag. pxy.outer is
the two column matrix of the points that are within the
fence. pxy.outlier represent the outliers. The vector
hdepths shows the depths of data points. is.one.dim
is TRUE if the data set is (nearly) one dimensional.
The dimensionality is decided by analysing the result of prcomp
which is stored in the element prdata. xy shows you
the data that are used for the bagplot. In the case of very large
data sets subsets of the data are used for constructing the
bagplot. A data set is very large if there are more data points
than approx.limit. xydata are the input data structured
in a two column matrix.
Note
Version of bagplot: 10/2012
Author(s)
Peter Wolf
References
P. J. Rousseeuw, I. Ruts, J. W. Tukey (1999):
The bagplot: a bivariate boxplot, The American
Statistician, vol. 53, no. 4, 382–387