###################### Primary Analysis (Figure 4) load("results.rda") vara <- 1.96*sqrt(results$SCE.var) reject <- ifelse(results$SCE > vara, 1, ifelse(results$SCE < -vara, -1, 0)) j<-24 ### Looking at month 24 postscript("vaxgen-nonwhite-relaxmon.eps",height=8,width=4.91,horizontal=FALSE) opar <- par(mfrow=c(3,2), mar=c(4.25,4.25,1.25,0.5)) for(i in seq(length=dim(reject)[4])) { image(beta0,beta1, reject[j,,,i], breaks=c(-1.5,-0.5,0.5,1.5), col=c(gray(.8),gray(1),gray(.6)),xlab="",ylab="", axes=FALSE) contour(beta0,beta1,results$SCE[j,,,i],add=T,lty=3,levels=c((0:20)/10-1),labcex=0.8, axes=FALSE) mtext(side=1, line=2.4, expression(OR[0]==exp(beta[0])),cex=.8) mtext(side=2, line=2.4, expression(OR[1]==exp(beta[1])),cex=.8) mtext(side=3, line=0, bquote(phi==.(format(phi[i], digits=2))),cex=.8) axis(side=1,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) axis(side=2,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) box() } par(opar) dev.off() #################### Figure 5 rm(list=ls()) source('sensitivitySGD.R', chdir=TRUE) vax<-scan("vax004po.txt", list(sid=0, Vx=0, sex=0, age=0, white=0, black=0, asian=0, hisp=0, otherrace=0, education=0, US=0, Canada=0, Netherlands=0, site=0, region=0, baselineriskscore=0, calenddayssinceentry=0, HIVinfection=0, daysinfectiongroup=0, daysinfectiondiagnosis=0, treatmentstart=0, daystreatmentstart=0, composite=0, dayscomposite=0, dayssinceinfectiondiagnosis=0, grouptime=0, viralload=0, CD4list=0)) id<-unique(vax$sid) trtstart<-daystrtstart<-comp<-dayscomp<-z<-white<-risk<-s<-daysinfectiondiagnosis<-NULL count<-1 for(i in 1:length(vax$sid)){ if (vax$sid[i]==id[count]) { trtstart[count]<-vax$treatmentstart[i] daystrtstart[count]<-vax$daystreatmentstart[i] comp[count]<-vax$composite[i] dayscomp[count]<-vax$dayscomposite[i] z[count]<-vax$Vx[i] white[count]<-vax$white[i] risk[count]<-vax$baselineriskscore[i] s[count]<-vax$HIVinfection[i] daysinfectiondiagnosis[count]<-vax$daysinfectiondiagnosis[i] count<-count+1 } } ### Looking only inside the non-white cohort z<-z[white==0] s<-s[white==0] trtstart<-trtstart[white==0] daystrtstart<-daystrtstart[white==0] ## number patients N<-length(z) ## number vaxinated Nv<-sum(z) ## number placebo Np<-N-Nv ## number infected that where not vacinated np<-sum((1-z)*s) ## number infected that where vacinated nv<-sum(z*s) d<-trtstart y<-daystrtstart/365.25 p0<-np/Np p1<-nv/Nv beta0<- -1 beta1<- -1 phi <- 0.95 Pi<-phi*p1 psi<-c(log((1-p0-p1+Pi)*Pi / ((p0-Pi)*(p1-Pi)))) library(survival) t.points<-summary(survfit(Surv(y[s==1],d[s==1])~1))$time plotstuff<-function(beta0,beta1,phi,arm,ltystuff,lwdstuff){ ans<-sensitivitySGD(z=z,y=y, s=s, d=d, beta0=beta0, beta1=beta1, psi=psi, ci=0.95, N.boot=1, selection=1L, groupings=c(0L,1L), empty.principle.stratum=c(0L,1L), trigger=1L, ci.method='bootstrap', tau = 24, time.points=t.points) F1ai<-ans$coeffs[[1]]$beta1.coeff[[1]]$SCE F0ai<-ans$coeffs[[1]]$beta0.coeff[[1]]$SCE if (arm==1) { lines(c(0,rep(t.points,each=2),3),c(1,1,rep(1-F1ai,each=2)),lty=ltystuff,lwd=lwdstuff) } if (arm==0) { lines(c(0,rep(t.points,each=2),3),c(1,1,rep(1-F0ai,each=2)),lty=ltystuff,lwd=lwdstuff) } if (arm==3) { lines(c(rep(t.points,each=2),3)[-1],c(rep(ans$SCE,each=2)),lty=ltystuff,lwd=lwdstuff) } } postscript("vaxgen-nonwhite-over-time.eps",height=8,width=3.2,horizontal=FALSE) par(mfrow=c(3,1),mar=c(4,4,2,.95)) plot(c(0,2),c(0,1),type="n",xlab="Years from HIV Diagnosis",ylab="Probability of Not Starting ART") plotstuff(0,0,.9,0,1,1) plotstuff(log(.5),0,.9,0,2,1) legend(1.25,1,c(expression(OR[0]==1),expression(OR[0]==0.5)),lty=c(1,2),bty="n",cex=.9) text(0,.03,"Placebo Arm",cex=1,pos=4) plot(c(0,2),c(0,1),type="n",xlab="Years from HIV Diagnosis",ylab="Probability of Not Starting ART") plotstuff(0,0,.9,1,1,1) plotstuff(0,log(.5),.9,1,2,1) legend(1.25,1,c(expression(OR[1]==1),expression(OR[1]==0.5)),lty=c(1,2),bty="n",cex=.9) text(0,.03,"Vaccine Arm",cex=1,pos=4) plot(c(0,2),c(-.4,.4),type="n",xlab="Years from HIV Diagnosis",ylab="SCE(t)") plotstuff(0,0,.9,3,1,1) plotstuff(log(.5),0,.9,3,2,1) plotstuff(0,log(.5),.9,3,3,1) plotstuff(log(.5),log(.5),.9,3,4,1) legend(.95,.42,legend=c(expression(list(OR[0]==1,OR[1]==1)),expression(list(OR[0]==0.5,OR[1]==1)), expression(list(OR[0]==1,OR[1]==0.5)),expression(list(OR[0]==0.5,OR[1]==0.5))), lty=c(1,2,3,4),bty="n",cex=.9) text(0,-0.37,"Difference between Arms",cex=1,pos=4) dev.off() ######################## Principal stratum defined as infection within 3 years (Figure 1 of Supplemental Material) load("vaxgen_followup.Rda") vara1 <- sqrt(ans3$SCE.var) reject1 <- ifelse(ans3$SCE < qnorm(0.025)*vara1, -1, ifelse(ans3$SCE > qnorm(0.975)*vara1, 1, 0)) postscript("VaxgenFollow3.eps",height=8,width=4.91,horizontal=FALSE) opar <- par(mfrow=c(3,2), mar=c(4.25,4.25,1.25,1.25)) i <- 2 for(j in seq_along(phi3)) { image(beta0,beta1, reject1[i,,,j], breaks=c(-1.5,-0.5,0.5,1.5), col=c(gray(.85),gray(1),gray(.6)),xlab="",ylab="", axes=FALSE, ann=FALSE, xlim=range(beta0), ylim=range(beta1)) contour(beta0,beta1,ans3$SCE[i,,,j],add=T,lty=3,levels=c((0:20)/10-1),labcex=0.8, axes=FALSE) mtext(side=1, line=2.4, expression(OR[0]==exp(beta[0])),cex=.8) mtext(side=2, line=2.4, expression(OR[1]==exp(beta[1])),cex=.8) mtext(side=3, line=0, bquote(phi==.(format(phi3[j], digits=2))),cex=.8) axis(side=1,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) axis(side=2,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) box() } dev.off() ######################## Principal stratum defined as within 2 years (Figure 2 of Supplemental Material) load("vaxgen_followup.Rda") vara1 <- sqrt(ans2$SCE.var) reject1 <- ifelse(ans2$SCE < qnorm(0.025)*vara1, -1, ifelse(ans2$SCE > qnorm(0.975)*vara1, 1, 0)) postscript("VaxgenFollow2.eps",height=8,width=4.91,horizontal=FALSE) opar <- par(mfrow=c(3,2), mar=c(4.25,4.25,1.25,1.25)) i <- 2 for(j in seq_along(phi2)) { image(beta0,beta1, reject1[i,,,j], breaks=c(-1.5,-0.5,0.5,1.5), col=c(gray(.85),gray(1),gray(.6)),xlab="",ylab="", axes=FALSE, ann=FALSE, xlim=range(beta0), ylim=range(beta1)) contour(beta0,beta1,ans2$SCE[i,,,j],add=T,lty=3,levels=c((0:20)/10-1),labcex=0.8, axes=FALSE) mtext(side=1, line=2.4, expression(OR[0]==exp(beta[0])),cex=.8) mtext(side=2, line=2.4, expression(OR[1]==exp(beta[1])),cex=.8) mtext(side=3, line=0, bquote(phi==.(format(phi2[j], digits=2))),cex=.8) axis(side=1,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) axis(side=2,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) box() } dev.off() ######################## Principal stratum defined as within 3 years and Y defined as time from ######################## randomization until initiation ART. (Figure 3 of Supplemental Material) load("vaxgen_altY_3year_variable_followup.Rda") ans2<-altYFollow3Year$sens vara1 <- sqrt(ans2$SCE.var) reject1 <- ifelse(ans2$SCE < qnorm(0.025)*vara1, -1, ifelse(ans2$SCE > qnorm(0.975)*vara1, 1, 0)) phi2<-altYFollow3Year$phi postscript("altYFollow3Year.eps",height=8,width=4.91,horizontal=FALSE) opar <- par(mfrow=c(3,2), mar=c(4.25,4.25,1.25,1.25)) i <- 1 for(j in seq_along(phi2)) { image(beta0,beta1, reject1[i,,,j], breaks=c(-1.5,-0.5,0.5,1.5), col=c(gray(.85),gray(1),gray(.6)),xlab="",ylab="", axes=FALSE, ann=FALSE, xlim=range(beta0), ylim=range(beta1)) contour(beta0,beta1,ans2$SCE[i,,,j],add=T,lty=3,levels=c((0:20)/10-1),labcex=0.8, axes=FALSE) mtext(side=1, line=2.4, expression(OR[0]==exp(beta[0])),cex=.8) mtext(side=2, line=2.4, expression(OR[1]==exp(beta[1])),cex=.8) mtext(side=3, line=0, bquote(phi==.(format(phi2[j], digits=2))),cex=.8) axis(side=1,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) axis(side=2,at=log(c(.05,.1,.2,.5,1,2,5,10,20))/12,label=c(".05",".1",".2",".5","1","2","5","10","20"),cex.axis=1) box() } dev.off()