bplot {asbio} | R Documentation |
Barplots with error bars (including interval plots)
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 be used to display letters indicating if comparisons of locations are significant after adjustment for simultaneous inference (see pairw.anova
, pairw.kw
, and/or pairw.fried
).
Usage
bplot(y, x, bar.col = "gray", loc.meas = mean, sort = FALSE, order = NULL, 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, xpd = FALSE,
print.summary = TRUE, ...)
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. |
sort |
Logical, if |
order |
A vector of length equal to the number of factor levels, specifying the order of bars with respect to the alphanumeric order of their names. |
int |
Type of error bar to be drawn, must be one of |
conf |
Level of confidence, 1 - P(type I error). |
uiw |
Upper y-coordinate for the error bar, if |
liw |
Lower y-coordinate for the error bar, if |
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 |
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 |
ylim |
Upper and lower limits of the Y-axis |
horiz |
Logical value. If |
xpd |
Logical value. If |
print.summary |
Logical value. If |
... |
Additional arguments from |
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
.
Value
A plot is returned. Bar centers (ala barplot
) are returned invisibly.
Author(s)
Ken Aho
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
mad
, barplot
, pairw.anova
, pairw.kw
, pairw.fried
Examples
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"))