I am making a failure plot and would like to have the at risk table show up above the x-axis line but below the y=0 point. This is because for this plot most of the data is near the bottom so it overlaps too much (right now I am putting the table at the top of the graph). The following will fit the curve in this white area - Specifically the ylim and y.n.risk options (the latter sets the bottom position of the at risk table). However, I do not want the y-axis to show a label for -0.2 because obviously that does not make sense for survival. Is there a way to hide this value?
survplot(cm1b_surv, fun=function(y)(1-y), lty=c(1,2,3),xlim=c(0,30),ylim=c(-0.2,0.8),time.inc=5,
conf='none', n.risk=TRUE, adj.n.risk=0.5, cex.n.risk=0.65, levels.only=TRUE, y.n.risk=-0.2,
xlab='Time from Donation to Event (Years)',
ylab='Probability of Diagnosis')
Ironically enough, SAS (which is what my experience is in for 12 years) does let you do that, and I would like a plot to mimic that specific aspect. See figure 8 in this pdf:
https://support.sas.com/resources/papers/proceedings13/427-2013.pdf
edit: Here's a reproducible example. Sorry but I haven't figured out all the formatting tricks yet. This code will generate a sample cumulative probability curve with the at risk table in the negative portion of the y-axis. I'd like to hide the -0.2 value and the tick mark if possible from the y-axis.
library(rms)
library(survival)
yrs_sample<-c(1:100)
Prob <- c(0.9, 0.3, 0.6, 0.8, 0.23, 0.45, 0.1, 0.3, 0.5, 0.03)
niter<- 100
randomSample<-rbinom(niter,1,prob=rep(Prob,niter))
surv_sample<-data.frame(yrs_sample,randomSample)
sample_surv<-npsurv(Surv(yrs_sample,randomSample)~1,data=surv_sample)
survplot(sample_surv, fun=function(y)(1-y),lty=c(1,2,3),xlim=c(0,30),ylim=c(-0.2,0.8),time.inc=5, conf='none', n.risk=TRUE, adj.n.risk=0.5, cex.n.risk=0.65, levels.only=TRUE, y.n.risk=-0.2)
Thanks!
Scott