This really does look to be more appropriate to an [r] tagged question in SO but there seems to be a surprisingly wide degree of tolerance for such questions in CV, so here goes. The answer also assumes you did not really want to use the existing boxplot()
function which is what would be used to construct a true box-and-whiskers plot (and which doesn't really use binomial CI's, but rather uses the Tukey defined fivenum()
function ). The plotrix and gplots packages both have what appears to be the same plotCI function;
est1 <- binom.test(100,1000) ; est2 <- binom.test(125,1000)
estvals <- rbind( c(est1$estimate, est1$conf.int[1], est1$conf.int[2]),
c(est2$estimate, est2$conf.int[1], est2$conf.int[2]))
plotCI(x = c(1,2), estvals[,1], ui=estvals[,3], li=estvals[,2],
xlim=c(0.5,2.5), ylim=c(0, 0.15) , xaxt="n", xlab="Groups")
The basic function is the arrows()
plotting function with an argument that splays the points of the arrows to 90 degrees in both directions.
R's boxplot function, by default, uses boxplot.stats
to calculate the boxes, whiskers, etc... boxplot.stats
calls the fivenum
function:
> fivenum(c(0.734522222, 0.939425))
[1] 0.7345222 0.7345222 0.8369736 0.9394250 0.9394250
According to ?fivenum
:
Tukey's five number summary (minimum, lower-hinge, median, upper-hinge, maximum)
The minimum and lower-hinge are identical. Similarly, the upper-hinge and maximum are identical.
Best Answer
If this is your entire graph:
Median and Q1 are all at the bottom. Your data is not normally distributed (almost all of your data is that one value at the bottom.)