View source: R/archive/bagplot0.R
bagplot2 | R Documentation |
A non-ggplot2 bagplot based on mrfDepth::bagplot.
bagplot2( x, y = NULL, colorbag = NULL, colorloop = NULL, colorchull = NULL, databag = TRUE, dataloop = TRUE, plot.fence = FALSE, type = "hdepth", sizesubset = 500, extra.directions = FALSE, options = NULL, ... )
x, y |
the x and y arguments provide the x and y coordinates for the bagplot.
Any reasonable way of defining the coordinates is acceptable. See the function |
colorbag |
The color of the bag (which contains the 50% observations with largest depth). |
colorloop |
The color of the loop (which contains the regular observations). |
colorchull |
When the bagplot is based on halfspace depth, the depth region with maximal depth is plotted. This argument controls its color. |
databag |
Logical indicating whether data points inside the bag need to be plotted. |
dataloop |
Logical indicating whether data points inside the fence need to be plotted. |
plot.fence |
Logical indicating whether the fence should be plotted. |
type |
Determines the depth function used to construct the bagplot: |
sizesubset |
When computing the bagplot based on halfspace depth,
the size of the subset used to perform the main
computations. See Details for more information. |
extra.directions |
Logical indicating whether additional directions should
be considered in the computation of the fence for the
bagplot based on projection depth or skewness-adjusted
projection depth. If set to |
options |
A list of options to pass to the
|
... |
further parameters given to |
The bagplot has been proposed by Rousseeuw et al. (1999) as a generalisation of the boxplot to bivariate data. It is constructed based on halfspace depth and as such is invariant under affine transformations. Similar graphical representations can be obtained by means of other depth functions, as illustrated in Hubert and Van der Veeken (2008) and in Hubert et al. (2015). See mrfDepth::compBagplot for more details.
The deepest point is indicated with a "*" sign, the outlying observations with red points.
Invisibly the result of the call to mrfDepth::compBagplot
Rousseeuw P.J., Ruts I., Tukey, J.W. (1999). The bagplot: a bivariate boxplot. The American Statistician, 53, 382–387.
Hubert M., Van der Veeken S. (2008). Outlier detection for skewed data. Journal of Chemometrics, 22, 235–246.
Hubert M., Rousseeuw P.J., Segaert, P. (2015). Rejoinder to 'Multivariate functional outlier detection'. Statistical Methods & Applications, 24, 269–277.
mrfDepth::compBagplot and mrfDepth::bagplot
bagplot2(iris$Sepal.Length, iris$Sepal.Width) bagplot2(iris[,1:2]) bagplot2(iris[,3:4], title="Bagplot with Tukey depth", xlab="Petal.Length", ylab="Petal.Width") # library("mrfDepth") data("bloodfat") result <- compBagplot(bloodfat) bagplot(result, colorbag = rgb(0.2,0.2,0.2), colorloop = "green")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.