wtd.boxplot {weights} | R Documentation |
Weighted boxplot
Description
wtd.boxplot
produces boxplots for weighted data by group, accounting for weights when computing medians and quartiles.
Usage
wtd.boxplot(x, group = NULL, weight = NULL, show.outliers = TRUE,
whisker.mult = 1.5, box.col = "lightgray", border = "black", ...)
Arguments
x |
Numeric vector of values. |
group |
Optional grouping factor. |
weight |
Optional numeric vector of weights. If |
show.outliers |
Logical. If |
whisker.mult |
Numeric multiplier for the IQR to define whiskers (default is 1.5, as in standard boxplots). |
box.col |
Color for the box portion of the plot. |
border |
Color for the boxplot borders. |
... |
Value
A base R graphic is produced showing weighted boxplots by group. No value is returned.
Author(s)
Josh Pasek
See Also
boxplot
, wtd.quantile
, wtd.median
Examples
set.seed(123)
x <- rnorm(100)
group <- rep(letters[1:2], each = 50)
w <- runif(100, 0.5, 2)
wtd.boxplot(x, group, weight = w)
[Package weights version 1.1.2 Index]