Learn R Programming

asbio (version 1.0-5)

bplot: Barplots with error bars for pairwise comparisons.

Description

Creates barplots for displaying statistical summaries by treatment (e.g. means, medians, M-estimates of location, standard deviation, variance, etc.)and their error estimates by treatment (i.e. standard errors, confidence intervals, IQRs, IQR confidence intervals, and MAD intervals). Custom intervals can also be created. The function can also display letters indicating if results were significant after adjustment for simultaneous inference.

Usage

bplot(y, x, bar.col = "gray", loc.meas = mean, order = FALSE, int = "SE",
 conf = 0.95, uiw = NULL, liw = NULL, sfrac = 0.1, slty = 1, scol = 1,
 slwd = 1, exp.fact = 1.5, simlett = FALSE, lett.side = 3, lett = NULL,
 cex.lett = 1, names.arg = NULL, ylim = NULL, horiz = FALSE, ...)

Arguments

y
A quantitative vector representing the response variable.
x
A categorical vector representing treatments (e.g. factor levels).
bar.col
Color of bar.
loc.meas
Measure of location or other summary statistic, e.g. mean, median, etc.
order
Logical, if TRUE, then treatments are ordered by their location statistics.
int
Type of error bar to be drawn, must be one of "SE", "CI", IQR, "MAD", or "IQR.CI". IQR-derived confidence intervals are based on +/-1.58 IQR/sqrt(n) and prov
conf
Level of confidence, 1 - P(type I error).
uiw
Upper y-coordinate for the error bar, if NULL then this will be computed from int.
liw
Lower y-coordinate for the error bar, if NULL then this will be computed from int.
sfrac
Scaling factor for the size of the "serifs" (end bars) on the confidence bars, in x-axis units.
slty
Line type for error bars.
scol
Line color for error bars.
slwd
Line width for error bars.
exp.fact
A multiplication factor indicating how much extra room is made for drawing letters in top of graph. Only used if simlett = TRUE.
simlett
A logical statement indicating whether or not letters should be shown above bars indicating that populations means have been determined to be significantly different.
lett.side
Side that letters will be drawn on, 1 = bottom, 2 = left, 3 = top, 4 = right.
lett
A vector of letters or some other code to display multiple comparison results.
cex.lett
Character expansion for multiple comparison result letters.
names.arg
A vector of names to be plotted below each bar or error bar. If this argument is omitted, then the names are taken from the names attribute of y.
ylim
Upper and lower limits of the Y axis
horiz
Logical value. If FALSE, then bars are drawn vertically with the first bar to the left. If TRUE, then bars are drawn horizontally with the first at the bottom.
...
Additional arguments from barplot.

Value

  • A plot is returned.

Details

It is often desirable to display the results of a pairwise comparison procedure using sample measures of location and error bars. This functions allows these sorts of plots to be made. The function is essentially a wrapper for the function barplot.

References

Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P. A. (1983) Graphical Methods for Data Analysis. Wadsworth & Brooks/Cole. McGill, R., Tukey, J. W. and Larsen, W. A. (1978) Variations of box plots. The American Statistician 32, 12-16.

See Also

barplot

Examples

Run this code
eggs<-c(11,17,16,14,15,12,10,15,19,11,23,20,18,17,27,33,22,26,28)
trt<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,4,4,4)
bplot(y=eggs, x=factor(trt),int="SE",xlab="Treatment",ylab="Mean number of eggs",
simlett=TRUE, lett=c("b","b","b","a"))

Run the code above in your browser using DataLab