data(dataDIVAT2)
#The outcome model base on a Super Learner from the first 150 individuals
sl1<-sl.time( methods=c("aft.gamma", "ph.gompertz"), metric="bs",
data=dataDIVAT2[1:150,], times="times", failures="failures", group="ecd",
cov.quanti=c("age"), cov.quali=c("hla", "retransplant"), cv=3)
#Set the prognostic time, for instance:
pro.time <- min(c(
max(dataDIVAT2$times[dataDIVAT2$ecd==0]),
max(dataDIVAT2$times[dataDIVAT2$ecd==1]) ))
#Conditional effect of the ECD by using a SL: use 1000 iterations instead of 2
hr.sl <- hr.sl.time(sl1, pro.time=pro.time, iterations=2, n.cluster=1)
#Conditional effect of the ECD by using a Cox model
cox.cdt <- coxph(Surv(times,failures) ~ ecd + age + retransplant,
data=dataDIVAT2)
data.frame( rbind(
summary(cox.cdt)$coef[1,c(1,2,5)],
hr.sl$logHR.conditional[,c(1,2,5)] ))
Run the code above in your browser using DataLab