# data and programme code for: # Christian Gold, Creating graphs of meta-analyses with R # presented at useR! - The R user conference, Vienna, May 2004 ### data studies<-c("Eidson (1989)", "Laserer-Tschann (1992)", "Haines (1989)", "Gregoire et al. (1989)", "Michel & Martin (1970)", "Clendenon-Wallen (1991)", "Aldridge et al. (1995)", "Johnson (1981)", "McQueen (1975)", "Montello & Coons (1998)", "Edgerton (1994)", "Combined (all studies)", "Combined (excl. outlier)") n<-c(25, 14, 16, 11, 26, 11, 8, 26, 24, 16, 11, 188, 177) d<-c(-.17, .25, .30, .30, .32, .53, .77, .78, .86, 1.43, 4.56, .99, .61) SE<-c(.50, .54, .51, .43, .40, .43, .52, .41, .49, .40, .81, .13, .14) ci.lower<-c(-1.20, -.93, -.79, -.60, -.51, -.37, -.35, -.07, -.16, .61, 2.87, .73, .33) ci.upper<-c(.86, 1.43, 1.39, 1.20, 1.15, 1.43, 1.89, 1.63, 1.88, 2.25, 6.25, 1.25, .89) design<-c("", "", "", "*", "", "*", "*", "", "", "*", "*", "", "") ### programme code # create 'empty' plot windows(width=10, height=7) plot(c(-16,5), c(0,16), axes=F, xlab="", ylab="", type="n") # set y positions for 10 studies and 2 summary points y.pos<-c(1:2, 3.5:13.5) # 'cut off' long confidence intervals (not to exceed graph area) ci.upper[ci.upper>5]<-5 # plot effect sizes for individual studies (point size increasing with precision) points(d[11:1], y.pos[3:13], pch=15, cex=(.7/SE^1)[11:1]) # plot confidence intervals segments(ci.lower[11:1], y.pos[3:13], ci.upper[11:1], y.pos[3:13], lwd=2) # plot grid lines segments(c(-5,0,5), rep(.5,3), c(-5,0,5), rep(14,3), lwd=2) # plot 2 summary points (spanning their confidence intervals) polygon(c(d[12], ci.upper[12], d[12], ci.lower[12]), c(2.2, 2, 1.8, 2), col=1) polygon(c(d[13], ci.upper[13], d[13], ci.lower[13]), c(1.2, 1, 0.8, 1), col=1) # add text columns text(-16, y.pos[13:1]-.2, studies, adj=c(0,0), font=c(rep(1,11), 2,2)) text(-9.5, y.pos[13:1]-.2, n, adj=c(1,0), font=c(rep(1,11),2,2)) text(-9.5, y.pos[13:1]-.2, design, adj=c(0,0)) text(-8, y.pos[13:1]-.2, format(d), adj=c(1,0), font=c(rep(1,11),2,2)) text(-6.5, y.pos[13:1]-.2, format(SE), adj=c(1,0), font=c(rep(1,11),2,2)) # add headings text(c(-16, -9.92, -8.82, -7.36), 14.8, c("Study", "n", "d", "SE"), adj=c(0,0), font=c(2,4,4,4)) # add x-axis labels text(seq(-5,5,2.5), 14.8, adj=c(0.5,0), format(seq(-5,5,2.5)), font=2)