data("dataDIVAT2")
formula<-Surv(times,failures) ~ age + hla + retransplant + ecd
tune.model <- tuneCOXen(formula=formula, data=dataDIVAT2, cv=5,
alpha=seq(.1, 1, by=.1), lambda=seq(.1, 1, by=.1))
tune.model$optimal$lambda # the estimated lambda value
# The estimation of the training modelwith the corresponding lambda value
model <- LIB_COXen(formula, data=dataDIVAT2,
alpha=tune.model$optimal$alpha,
lambda=tune.model$optimal$lambda)
# The resulted predicted survival of the first subject of the training sample
plot(y=model$predictions[1,], x=model$times, xlab="Time (years)",
ylab="Predicted survival", col=1, type="l", lty=1, lwd=2, ylim=c(0,1))
Run the code above in your browser using DataLab