##### CHANGE TO YOUR WORKING DIRECTORY setwd("~/DocInvest/MyPapers/sqj2012/datasets/sideeffects") ######################## ###### Figures 5 and 6 # actual values. Add this script to the others scripts R ci1score <- c(7.96, 9.71) ci1Xscore <- c(5.70, 8.96) #ci2score <- c(3.48, 5.52) ci2score <- c(5.21, 8.29) #scaled lowdelta20 <- -2.18 lowdelta25 <- -2.72 lowdelta50 <- -5.44 updelta20 <- 2.18 updelta25 <- 2.72 updelta50 <- 5.44 limxscore <- 11 namethisfile <- paste0(getwd(),"/Fig5",".pdf") pdf(file=namethisfile, height=3, width=4.5) #windows.options(width=10, height=5) par(mar=c(3,0,0,0)) plot(0,0,type="n", xlim=c(lowdelta20,limxscore), ylim=c(0,1.5),axes=FALSE, ann=FALSE) equivintervals <- c(limxscore,lowdelta20,0,updelta20,updelta50) equivintervals <- sort(equivintervals) labels <- c( # expression(-Delta[paste(50,'%',sep="")]), expression(-Delta[paste(20,'%',sep="")]), 0, expression(Delta[paste(20,'%',sep="")]), expression(Delta[paste(50,'%',sep="")]), limxscore) axis(1, at=equivintervals, labels = labels, pos=0) mtext(expression(mu[T]-mu[R]),at=0,side=1,line=2) mtext("More Score in SEF",at=updelta50,side=1,line=2) #abline(v=equivintervals,lty="dotted") segments(c(lowdelta50,updelta50),c(0,0),c(lowdelta50,updelta50),c(1.5,1.5), lty=3,lwd=1) segments(c(lowdelta20,updelta20),c(0,0),c(lowdelta20,updelta20),c(1,1), lty=3,lwd=1) segments(ci1score[1],0.2,ci1score[2],lty=1,lwd=5, lend=2) text(ci1score[1],0.2,"|",offset=0.5,cex=1.1,adj=1,font=2) text(ci1score[2],0.2,"|",offset=0.5,cex=1.1,adj=0,font=2) segments(ci1Xscore[1],0.7,ci1Xscore[2],lty=1,lwd=5, lend=2) text(ci1Xscore[1],0.7,"|",offset=0.5,cex=1.1,adj=1,font=2) text(ci1Xscore[2],0.7,"|",offset=0.5,cex=1.1,adj=0,font=2) segments(ci2score[1],1.2,ci2score[2],lty=1,lwd=5, lend=2) text(ci2score[1],1.2,"|",offset=0.5,cex=1.1,adj=1,font=2) text(ci2score[2],1.2,"|",offset=0.5,cex=1.1,adj=0,font=2) text(7.1,0.2, "Trial 1", offset=0.5,cex=0.9,adj=1) text(8.7,0.2, paste("(", round(ci1score[1],2),",", round(ci1score[2],2), ")"), pos=3,offset=0.5,cex=0.8,adj=1) text(5,0.7, "Trial 1X", offset=0.5,cex=0.9,adj=1) text(7.2,0.7, paste("(", round(ci1Xscore[1],2),",", round(ci1Xscore[2],2), ")"), pos=3,offset=0.5,cex=0.8,adj=1) text(3,1.2, "Trial 2", offset=0.5,cex=0.9,adj=1) text(6.5,1.2, paste("(", round(ci2score[1],2),",", round(ci2score[2],2), ")"), pos=3,offset=0.5,cex=0.8,adj=1) dev.off() # for pdf et al ###################################################################3 ## now for the TIME variable ###################################################################3 namethisfile <- paste0(getwd(),"/Fig6",".pdf") pdf(file=namethisfile, height=3, width=4.5) # ,pagecentre=TRUE) #, pagecentre=TRUE) #pdf("~/FigTime.pdf", height=5, width=9) #, pagecentre=TRUE) #limxtime <- max(abs(c(ci1time,ci1Xtime,ci2time))) ## should round to the largest and nearest digit plus extra axis space #charlim <- as.character(ceiling(limxtime)) #limxtime <- (as.numeric(substr(charlim,1,1))+1)*10^(nchar(charlim)-1) ci1time <- c(-119.22, -70.45) ci1Xtime <- c(-98.48, -40.57) #ci2time <- c(-368.22, -121.53) ci2time <- c(-104.62, -34.53) # scaled to Trial 1 # actual values lowdelta20t <- -74.62 lowdelta25t <- -93.28 lowdelta50t <- -186.56 updelta20t <- 74.62 updelta25t <- 93.28 updelta50t <- 186.56 limxtime <- 220 par(mar=c(3,0,0,0)) plot(0,0,type="n", xlim=c(lowdelta50t,updelta20t), ylim=c(0,1.5),axes=FALSE, ann=FALSE) equivintervals <- c(lowdelta50t,lowdelta20t,0,updelta20t) equivintervals <- sort(equivintervals) labels <- c( expression(-Delta[paste(50,'%',sep="")]), expression(-Delta[paste(20,'%',sep="")]), 0, expression(Delta[paste(20,'%',sep="")])) # expression(Delta[paste(20,'%',sep="")])) axis(1, at=equivintervals, labels = labels, pos=0) mtext(expression(mu[T]-mu[R]),at=0,side=1,line=2) mtext("Less Time in SEF",at=-120,side=1,line=2) #abline(v=equivintervals,lty="dotted") segments(c(lowdelta50t,updelta50t),c(0,0),c(lowdelta50t,updelta50t),c(1.5,1.5), lty=3,lwd=1) segments(c(lowdelta20t,updelta20t),c(0,0),c(lowdelta20t,updelta20t),c(1,1), lty=3,lwd=1) segments(ci1time[1],0.2,ci1time[2],lty=1,lwd=5, lend=2) text(ci1time[1],0.2,"|",offset=0.5,cex=1.1,adj=1, font=2) text(ci1time[2],0.2,"|",offset=0.5,cex=1.1,adj=0,font=2) segments(ci1Xtime[1],0.7,ci1Xtime[2],lty=1,lwd=5, lend=2) text(ci1Xtime[1],0.7,"|",offset=0.5,cex=1.1,adj=1,font=2) text(ci1Xtime[2],0.7,"|",offset=0.5,cex=1.1,adj=0,font=2) segments(ci2time[1],1.2,ci2time[2],lty=1,lwd=5, lend=2) text(ci2time[1],1.2,"|",offset=0.5,cex=1.1,adj=1,font=2) text(ci2time[2],1.2,"|",offset=0.5,cex=1.1,adj=0,font=2) text(-140,0.2, "Trial 1", offset=0.5,cex=0.9,adj=1) text(-90,0.2, paste("(", round(ci1time[1],2),",", round(ci1time[2],2), ")"), pos=3,offset=0.5,cex=0.8,adj=1) text(-120,0.7, "Trial 1X", offset=0.5,cex=0.9,adj=1) text(-70,0.7, paste("(", round(ci1Xtime[1],2),",", round(ci1Xtime[2],2), ")"), pos=3,offset=0.5,cex=0.8,adj=1) text(-140,1.2, "Trial 2", offset=0.5,cex=0.9,adj=0) text(-70,1.2, paste("(", round(ci2time[1],2),",", round(ci2time[2],2), ")"), pos=3,offset=0.5,cex=0.8,adj=1) dev.off() # for pdf etc.