data(dataDIVAT1)
### a description of transitions
table(dataDIVAT1$trajectory)
### patient-graft survival (first event between the return to dialysis and the patient
### death with a functioning graft)
dataDIVAT1$failure<-1*(dataDIVAT1$trajectory!=1 & dataDIVAT1$trajectory!=12)
dataDIVAT1$time<-NA
dataDIVAT1$time<-ifelse(dataDIVAT1$trajectory %in% c(1,12,13,14),
dataDIVAT1$time1,dataDIVAT1$time1+dataDIVAT1$time2)
plot(survfit(Surv(time/365.24, failure) ~ 1 , data=dataDIVAT1), mark.time=FALSE,
xlim=c(0,12), ylim=c(0,1), cex=1.5, col=1, lwd=2, lty=1,
xlab="Times after the transplantation (years)",
ylab="Patient-graft survival")
Run the code above in your browser using DataLab