[R] Plotting confidence intervals

phii m@iii@g oii phiiipsmith@c@ phii m@iii@g oii phiiipsmith@c@
Sun Dec 8 03:31:44 CET 2019


I want to show little bell curves on my bar chart to illustrate the 
confidence ranges. The following example from Paul Teetor's "R Cookbook" 
does what I want, but shows I-beams instead of bell curves. The I-beams 
suggest uniform, rather than normal distributions. So I am looking for a 
way to plot normal distribution curves instead.

# Example from Paul Teetor, "R Cookbook", page 238.
library(gplots)
attach(airquality)
heights <- tapply(Temp,Month,mean)
lower <- tapply(Temp,Month,function(v) t.test(v)$conf.int[1])
upper <- tapply(Temp,Month,function(v) t.test(v)$conf.int[2])
barplot2(heights,plot.ci=TRUE,ci.l=lower,ci.u=upper,
          ylim=c(50,90),xpd=FALSE,
          main="Mean Temp. By Month",
          names.arg=c("May","Jun","Jul","Aug","Sep"),
          ylab="Temp (deg. F)")

Does anyone know a package that does this or, alternatively, can anyone 
suggest a direction to go in if one were to write R code to do this?

Philip



More information about the R-help mailing list