error.bars {psych} | R Documentation |
One of the many functions in R to plot means and confidence intervals. Meant mainly for demonstration purposes for showing the probabilty of replication from multiple samples. Can also be combined with such functions as boxplot to summarize distributions. Means and standard errors are calculated from the raw data using describe
.
error.bars(x, ylab = "Dependent Variable",xlab="Independent Variable", main="95% confidence limits", ylim = NULL, ci = 1.96, labels = NULL, pos = NULL, arrow.len = 0.05, add = FALSE, ...)
x |
A data frame or matrix |
ylab |
y label |
xlab |
x label |
main |
title for figure |
ylim |
if specified, the limits for the plot, otherwise based upon the data |
ci |
What size confidence interval to use |
labels |
X axis label |
pos |
where to place text: below, left, above, right |
arrow.len |
How long should the top of the error bars be? |
add |
add=FALSE, new plot, add=TRUE, just points and error bars |
... |
other parameters to pass to the plot function, e.g., typ="b" to draw lines, lty="dashed" to draw dashed lines |
Drawing the mean +/- a confidence interval is a frequently used function when reporting experimental results. By default, the confidence interval is 1.96 standard errors.
Graphic output showing the means + x
William Revelle
See Also as error.crosses
, error.bars.by
x <- matrix(rnorm(500),ncol=20) error.bars(x) #now do a boxplot and then add error bars x.df <- as.data.frame(x) boxplot(x.df) error.bars(x.df, add=TRUE) error.bars(attitude) #another example