Create an error bar graph based on pairwise multiple comparisons
Description
Creates a graph to see pairwise comparisons amongst groups. The method of Andrews, Sarner, and Snee (1980) is applied to visualizes significant differences via nonoverlapping error bars.
Usage
1 2 3 
Arguments
estimates 
A named vector of estimates. Each estimate element is a measure that will be the center of the error bar of the group. The name of each group must be present in the names attribute of the vector. 
centralvar 
A single variance value to be used for each group's error bar
construction. In the canonical case it is the square of the estimated
standard error of the mean 
critpoint 
The single critical value of the theoretical reference distribution. In the
canonical case it is the tdistribution quantile for estimates derived from a
standard linear model with homoscedastic variance. It could also
reflect a multiplicity adjustment, or like the

endptscale 
Must be specified as 
analysisname 
Optional, a character text or
mathvalid expression that will be set for
default use in graph title and table methods. The default
value is the empty 
endptname 
Optional, a character text or mathvalid expression
that will be set for default use as the yaxis label of graph
methods, and also used for table methods. The default
value is the empty 
alpha 
Significance level, by default set to 
digits 
Optional, for output display purposes in graphs
and table methods, values will be rounded to this numeric
value. Only the integers of 0, 1, 2, 3, and 4 are accepted. No
rounding is done during any calculations. The default value is

approxstamp 
Add text to the graph that acknowledges that the error bar method is approximate. 
titlestamp 
Add text to the top margin above the graph area. 
offset 
Optional,
if for example a numeric constant was added to all response values
before calculation of the estimate as a mean, this could be used to
shift the axis marks appropriately. The default value is

ticklabels 
Optional, before graphing the data, remove any automatically generated tickmarks for the yaxis, and use these tickmarks instead. A vector of tickmarks to be placed on the yaxis. Any numeric representations will be coerced to character. 
... 
Additional arguments. None are currently used. 
Details
The statistical method of Andrews, Sarner, and Snee (1980) is applied to visualizes significant differences via nonoverlapping error bars. The method is exact when there are equal standard errors amongst the groups, and approximate otherwise. The method's usefulness declines as the standard errors become more disparate.
When two groups are compared, nonoverlapping error bars indicate a statistically significant pairwise difference. Conversely, if the error bars overlap, there is no such significant difference. In cases of approximation, or borderline overlap that is seen, the actual comparison needs to be consulted to judge significance with a pvalue.
The minimum and maximum values across all the bar ends
are added inside the plot region in blue, flush against the
yaxis. The number of decimal places are determined by the
digits
value.
Value
errorbargraph
returns
an invisible NULL
. The main purpose is the side
effect of graphing to the current device.
Warning
This function was created for internal use in the cg package as
its use can be seen in the errorBarGraph
methods
code. Therefore any direct use of it needs to be done cautiously.
Note
Contact cg@billpikounis.net for bug reports, questions, concerns, and comments.
Author(s)
Bill Pikounis [aut, cre, cph], John Oleynick [aut], Eva Ye [ctb]
References
Andrews, H.P., Snee, R.D., Sarner, M.H. (1980). "Graphical Display of Means," The American Statistician, 34, 195199.
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  data(canine)
canine.data < prepareCGOneFactorData(canine, format="groupcolumns",
analysisname="Canine",
endptname="Prostate Volume",
endptunits=expression(plain(cm)^3),
digits=1, logscale=TRUE, refgrp="CC")
canine.fit < fit(canine.data)
## Easier way: notice the camel case of the errorBarGraph call
errorBarGraph(canine.fit, model="olsonly")
## Manual way
## Instead of errorBarGraph(canine.fit, model="olsonly")
errorbargraph(estimates=canine.fit@olsfit$coef,
centralvar=((summary(canine.fit@olsfit)$sigma^2) /
unique(sapply(canine, length))),
critpoint=qt(0.975, df=canine.fit@olsfit$df.residual),
endptscale="log",
analysisname="Canine",
digits=1,
endptname=expression(paste( plain('Prostate Volume'),
' (', plain(cm)^3 , ')' ))
)
