data(dataDIVAT2)
dataDIVAT2$train <- 1*rbinom(n=dim(dataDIVAT2)[1], size = 1, prob=1/3)
# The training of the super learner with 2 models
sl<-sl.time(method=c("aft.gamma", "ph.exponential"),
metric="ribs", data=dataDIVAT2[dataDIVAT2$train==1,],
times="times", failures="failures", pro.time = 12,
cov.quanti=c("age"), cov.quali=c("hla", "retransplant", "ecd"), cv=3)
# The calibration plot from the validation sample
plot(sl, method="sl", n.groups=5, pro.time=12, col=2,
xlab="Predicted 12-year survival", ylab="Observed 12-year survival",
newdata=dataDIVAT2[dataDIVAT2$train==0,], times="times", failures="failures")
Run the code above in your browser using DataLab