12
$\begingroup$

I've found a paper which introduces the multidimensional (bivariate here) version of the boxplot - a bagplot. What is that bagplot exactly? I can see the series of nested polygons based on vertices, one of those polygons being declared as a bagplot. What is the idea of nested polygon building? Which of the polygons is the bagplot (central or holding the average number of points)? Do the edges of a bagplot possess some useful properties (like specifically dividing the point set)?

$\endgroup$
6
  • 3
    $\begingroup$ There is an article by Rousseeuw, Pits and Tukey in American Statistician that explains these. I am, for some reason, having trouble pasting the link, but Googling "bagplot" and "Tukey" will find it $\endgroup$ – Peter Flom Oct 31 '12 at 10:58
  • 1
    $\begingroup$ Only found it for outrageous price. Still searching. $\endgroup$ – mbaitoff Oct 31 '12 at 11:32
  • 1
    $\begingroup$ If you have access to any decent library, they should have it. American Statistician is pretty widely subscribed to. There was also something on quora, but I didn't look at it. $\endgroup$ – Peter Flom Oct 31 '12 at 11:51
  • 2
    $\begingroup$ Rousseeuw and Ruts have another article online besides the American Statistician one in postscript format for free. $\endgroup$ – Andy W Oct 31 '12 at 12:21
  • $\begingroup$ @AndyW, Asking you as a SPSS fellow: how do you think is it possible to do it via GPL somehow? Are you going to invent the code for us SPSSers? $\endgroup$ – ttnphns Mar 27 '16 at 8:47
14
$\begingroup$

Here's an example with notes:

Here is the article The Bagplot: A Bivariate Boxplot by Peter J. Rousseeuw , Ida Ruts & John W. Tukey from The American Statistician: http://venus.unive.it/romanaz/ada2/bagplot.pdf

From the abstract of that article:

The “depth median” is the deepest location, and it is surrounded by a “bag” containing the n/2 observations with largest depth. Magnifying the bag by a factor 3 yields the “fence” (which is not plotted). Observations between the bag and the fence are marked by a light gray loop, whereas observations outside the fence are flagged as outliers. The bagplot visualizes the location, spread, correlation, skewness, and tails of the data.

Here's an illustration of the key parts:

enter image description here

Additional discussion can be found in the following:

From the help docs of the aplpack package (for R users):

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 hull, the bag of bagplot. In the bag are 50 percent of all points. The fence separates points in the fence from points outside. It is computed by increasing the the bag. The loop is defined as the convex polygon 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. There are known difficulties with small data sets (But I think it is not wise to make a (graphical) summary of e.g. 10 points.)

In case people want to plot multiple (overlappIng) bagplots, it is convenient if the plots are semi-transparent. For this reason the transparency flag has been added to the bagplot command. 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.

And an example:

library(aplpack)
attach(mtcars)
bagplot(wt, mpg, xlab="Car Weight", 
        ylab="Miles Per Gallon",
        main="Bagplot Example", 
        transparency = TRUE, 
        show.whiskers = FALSE, 
        # note that data a 'fence' separates inliers from outliers, 
        # and a 'loop' indicates the points outside the bag but 
        # inside the fence. In the 'bag' are 50 percent of all 
        # points
        show.loophull = TRUE, # draw 'loop'?
        show.baghull = TRUE)  # draw 'bag'?

enter image description here

related questions:

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.