# Makes Figure 5(ii) in Rosenbaum (2022).
data(aHDL)
y<-t(matrix(aHDL$hdl,4,406))
y<-y[,c(1,3,2,4)]
grp<-c("D","N","R","B")
# Figure 3 in Rosenbaum (2022)
boxplotTTBlockDesign(y,grp=grp,tcks=c(-200,-50,-20,0,20,50,200),
ylab="HDL Difference",xlab="Group Comparisons")
# Same figure, different transformation, p=-2
boxplotTTBlockDesign(y,p=-2,grp=grp,tcks=c(-200,-50,-20,0,20,50,200),
ylab="HDL Difference",xlab="Group Comparisons")
# Figure 5 in Rosenbaum (2022). The three control groups have been merged.
# Note that the C-C boxplot is perfectly symmetric about zero, and less
# dispersed than the T-C boxplot.
grp<-c("D","C","C","C")
boxplotTTBlockDesign(y,grp=grp,tcks=c(-200,-50,-20,0,20,50,200),
ylab="HDL Difference",xlab="Group Comparisons")
# The same figure can be produced explicitly using boxplotTTlist.
TC<-c(y[,1]-y[,2],y[,1]-y[,3],y[,1]-y[,4])
CC<-c(y[,2]-y[,3],y[,2]-y[,4],y[,3]-y[,4])
CC<-c(CC,-CC)
ylist<-list(TC=TC,CC=CC)
boxplotTTlist(ylist,tcks=c(-200,-50,-20,0,20,50,200),ylab="HDL Difference")
# More variations: Keep group B separate
grp<-c("D","C","C","B")
boxplotTTBlockDesign(y,grp=grp,tcks=c(-50,-20,0,20,50),
symZero=FALSE,main=" ",p=1/2)
boxplotTTBlockDesign(y,grp=grp,tcks=c(-200,-50,-20,0,20,50,200),
main="",p=-1,internal=FALSE)
Run the code above in your browser using DataLab