LIB_COXall {survivalSL} | R Documentation |
Library of the Super Learner for Cox Regression
Description
Fit a Cox regression for all covariates to be used in the super learner.
Usage
LIB_COXall(formula, data)
Arguments
formula |
A formula object, with the response on the left of a ~ operator, and the terms on the right. The response must be a survival object as returned by the |
data |
A data frame whose columns correspond to the variables present in the formula. |
Details
The Cox regression is obtained by using the survival
package.
Value
formula |
The formula object used for model construction. |
model |
The estimated model. |
data |
The data frame used for learning. |
times |
A vector of numeric values with the times of the |
predictions |
A matrix with the predictions of survivals of each subject (lines) for each observed time (columns). |
References
Terry M. Therneau (2021). A Package for Survival Analysis in R. R package version 3.2-13, https://CRAN.R-project.org/package=survival.
Examples
data("dataDIVAT2")
# The estimation of the model from the first 200 lines
formula<-Surv(times,failures) ~ age + hla + retransplant + ecd
data<-dataDIVAT2[1:200,]
model <- LIB_COXall(formula=formula, data=data)
# The 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))