bplot: Boxplot with Lowess Curves, Jittered Data, Overlaid Mean and...

Description Usage Arguments Value Author(s) See Also Examples

Description

This function adds functionality to the base R boxplot function. Now it is straightforward to add jittered data to the plot, and to overlay information about the sample mean and standard deviation. The function also supports stratification.

Usage

1
2
3
4
5
bplot(y, x=rep(1, length(y)), data = NA, strata = NULL, xjitter = TRUE, yjitter = TRUE, 
      range = 0, sd = TRUE, sdx = TRUE, log = FALSE, 
      cex = c(meancex = 1, jittercex = 0.8), 
      col = c(sdcol = "dodgerblue3", jittercol = "gray30"), main = NULL, xlab = NULL, 
      ylab = NULL, names = NULL, ylim = NULL, legend=FALSE)

Arguments

y

dependent variable.

x

independent variable. Must by the same length as y.

data

if entered, must contain both y and x.

strata

strata variable(s), used to stratify the plot.

xjitter

a logical specifying if the jittered data (jittered on x-axis) are to be displayed or not. Default is TRUE.

yjitter

a logical specifying if the jittered data (jittered on y-axis) are to be displayed or not. Default is TRUE.

range

passed to the boxplot() function. This determines how far the plot whiskers extend out from the box. If range is positive, the whiskers extend to the most extreme data point which is no more than range times the interquartile range from the box. A value of zero causes the whiskers to extend to the data extremes.

sd

a logical specifying if the standard devation of y should be overlaid on the plot. Default value is TRUE.

sdx

a logical specifying if the standard deviation of x should be overlaid on the plot. Default value is TRUE.

log

a logical specifying if the data are to be displayed on a log scale. Passed to boxplot(). Default value is FALSE.

cex

passed to boxplot().

col

passed to boxplot().

main

passed to plot(), the main title of the plot.

xlab

passed to plot(), the x-axis label.

ylab

passed to plot(), the y-axis label.

names

names (if any) of x.

ylim

the range for plotting the y-axis, passed to plot.

legend

a logical value. If TRUE, (and the means and standard deviations have been overlaid on the graph) displays a legend next to the first boxplot plotted denoting the max, mean+sd, mean, mean-sd, and min values.

Value

Produces a plot. No value is returned.

Author(s)

Scott S. Emerson, M.D., Ph.D., Andrew J. Spieker, Brian D. Williamson, Travis Y. Hee Wai, and Solomon Lim

See Also

boxplot

Examples

1
2
3
4
5
6
#- Read in and attach the data -#
mri <- read.table("http://www.emersonstatistics.com/datasets/mri.txt", header=TRUE)
attach(mri)

#- Produce box plot with jittered data, sample mean, and sd -#
bplot(y=atrophy, x=male, xlab="Gender", ylab="Atrophy")

uwIntroStats documentation built on May 2, 2019, 4:34 a.m.