I would like to tie off this thread (?!?!) by thanking Jeff Newmiller, Rui Barradas, Avi Gross and Bill Dunlap for their advice and insight.
I have attached the code that I finally put together, on the basis of the aforementioned advice, in the file ciPlot.txt. I have also attached the necessary data set in the file egDat.txt. Just in case anyone is interested or in case someone else might benefit from seeing this code. cheers, Rolf Turner -- Honorary Research Fellow Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276
# # Script ciPlot.txt for doing the confidence interval plots that # I wanted. # library(ggplot2) cidf <- dget("egDat.txt") cidf.a <- cidf[cidf$param=="alpha",] cidf.b <- cidf[cidf$param=="beta",] Ylab.a <- expression(paste("Bias in ",alpha)) Ylab.b <- expression(paste("Bias in ",beta)) Part.a <- ggplot(cidf.a, aes(Ndat, estimate)) + geom_errorbar(aes(ymin = lower, ymax = upper), width = 50) + geom_point(size = 1) + geom_hline(yintercept = 0,col="red") + labs(x="",y=Ylab.a) + theme_bw() + theme(axis.title.x=element_text(size=14), axis.title.y=element_text(size=14)) + theme(axis.text.x=element_text(size=14), axis.text.y=element_text(size=14)) + theme(panel.border=element_rect(linetype="solid",fill=NA), panel.grid.minor=element_blank(), panel.grid.major=element_blank()) Part.b <- ggplot(cidf.b, aes(Ndat, estimate)) + geom_errorbar(aes(ymin = lower, ymax = upper), width = 50) + geom_point(size = 1) + geom_hline(yintercept = 0,col="red") + labs(x="Sample size",y=Ylab.b) + theme_bw() + theme(axis.title.x=element_text(size=14), axis.title.y=element_text(size=14)) + theme(axis.text.x=element_text(size=14), axis.text.y=element_text(size=14)) + theme(panel.border=element_rect(linetype="solid",fill=NA), panel.grid.minor=element_blank(), panel.grid.major=element_blank()) ciPlot <- cowplot::plot_grid(Part.a,Part.b,nrow=2) print(ciPlot)
structure(list(Ndat = c(100, 500, 1000, 1500, 2000, 100, 500, 1000, 1500, 2000), lower = c(0.209325514321019, 0.0403237235334606, 0.0145196529159657, 0.0216209917402008, -0.00989822805983288, 1.67646857307238, 0.293606879421865, 0.126166692157642, 0.135454331658732, -0.0506914315997755), estimate = c(0.328510135047226, 0.0804793047005517, 0.0401822279422254, 0.0422410687789209, 0.00959659685206644, 2.42401777661119, 0.512738636066594, 0.262346592121412, 0.245742220593958, 0.0555399174577091), upper = c(0.447694755773433, 0.120634885867643, 0.0658448029684851, 0.0628611458176411, 0.0290914217639658, 3.17156698015001, 0.731870392711323, 0.398526492085181, 0.356030109529183, 0.161771266515194 ), param = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L ), .Label = c("alpha", "beta"), class = "factor")), class = "data.frame", row.names = c(NA, -10L))
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.