predict.sltime {survivalSL} | R Documentation |
Prediction from a Super Learner for Censored Outcomes
Description
Predict the survival of new observations based on an SL by using the survivalSL
function.
Usage
## S3 method for class 'sltime'
predict(object, newdata, newtimes, ...)
Arguments
object |
An object returned by the function |
newdata |
An optional data frame containing covariate values at which to produce predicted values. The default value is |
newtimes |
The times at which to produce predicted values. The default value is |
... |
For future methods. |
Value
predictions |
A list of matrix with the predictions of survivals of each subject (lines) for each observed time (columns) for each model used for the superlearner construction and the superlearner itself. |
times |
A vector of numeric values with the times of the |
See Also
Examples
data("dataDIVAT2")
# The training of the super learner from the first 150 individuals of the data base
formula<-Surv(times,failures) ~ age + hla + retransplant + ecd
sl1 <- survivalSL(formula, data=dataDIVAT2[1:150,],
method=c("LIB_COXridge", "LIB_AFTggamma"), metric="auc", pro.time = 12, cv=3)
# Individual prediction for 2 new subjects
pred <- predict(sl1,
newdata=data.frame(age=c(52,52),
hla=c(0,1), retransplant=c(1,1), ecd=c(0,1)))
plot(y=pred$predictions$sl[1,], x=pred$times,
xlab="Time (years)",
ylab="Predicted survival",
col=1, type="l", lty=1, lwd=2, ylim=c(0,1))
lines(y=pred$predictions$sl[2,], x=pred$times,
col=2, type="l", lty=1, lwd=2)
legend("bottomright", col=c(1,2), lty=1, lwd=2,
c("Subject #1", "Subject #2"))