powered by
wtd.boxplot produces boxplots for weighted data by group, accounting for weights when computing medians and quartiles.
wtd.boxplot
wtd.boxplot(x, group = NULL, weight = NULL, show.outliers = TRUE, whisker.mult = 1.5, box.col = "lightgray", border = "black", ...)
A base R graphic is produced showing weighted boxplots by group. No value is returned.
Numeric vector of values.
Optional grouping factor.
Optional numeric vector of weights. If NULL, equal weights are assumed.
NULL
Logical. If TRUE, show weighted outliers based on interquartile range.
TRUE
Numeric multiplier for the IQR to define whiskers (default is 1.5, as in standard boxplots).
Color for the box portion of the plot.
Color for the boxplot borders.
Additional graphical parameters passed to plot or rect.
plot
rect
Josh Pasek
boxplot, wtd.quantile, wtd.median
boxplot
wtd.quantile
wtd.median
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)
Run the code above in your browser using DataLab