survSuperLearner | R Documentation |
This function estimates conditional survival functions for the event and censoring times from right-censored data.
survSuperLearner(
time,
event,
X,
newX,
new.times,
event.SL.library,
cens.SL.library,
id = NULL,
verbose = FALSE,
control = list(),
cvControl = list(),
obsWeights = NULL
)
time |
|
event |
|
X |
|
newX |
|
new.times |
|
event.SL.library |
Library of candidate learners to use to estimate the conditional survival of the event. Should have the same structure as the |
id |
Optional |
verbose |
|
control |
Named list of parameters controlling the fitting process. See |
cvControl |
Named list of parameters controlling the cross-validation process. See |
obsWeights |
Optional |
The conditional survival function of the event at time t
given covariates X
is defined as the probability that the event occurs after time t
given covariate values x
. The conditional survival function of censoring is the probability that the censoring time occurs after t
given covariates x
. This function finds the optimal weighted combination, i.e. the Super Learner, of candidate learners for both of these functions simultaneously.
survSuperLearner
returns a named list with the following elements:
call |
The matched call. |
event.libraryNames , cens.libraryNames |
Parsed learner names. |
event.SL.library , cens.SL.library |
Libraries used for fitting. |
event.SL.predict , cens.SL.predict |
|
event.coef , cens.coef |
Fitted SuperLearner coefficients for the model for the conditional survival functions for the event and censoring times, respectively. |
event.library.predict , cens.library.predict |
|
event.Z , cens.Z |
|
event.cvRisk , cens.cvRisk |
Cross-validated risks for the candidate conditional event and censoring survival functions. |
event.fitLibrary , cens.fitLibrary |
Fitted conditional survival functions for all learners in the library on the full data. |
varNames |
Variable names of the training data. |
validRows |
Length |
event.whichScreen , cens.whichScreen |
Matrix indicating which variables were included in each screening algorithm in the full training data. |
control , cvControl |
Parameters used for controlling the fitting and cross-validation processes, respectively. |
event.errorsInCVLibrary , cens.errorsInCVLibrary |
Logical matrices indicating whether each learning algorithm encountered any errors in each cross-validation fold. |
event.errorsInLibrary , cens.errorsInLibrary |
Logical vectors indicating whether each learning algorithm encountered any errors on the full data. |
times |
Timing data. |
van der Laan, M. J., Polley, E. C., & Hubbard, A. E. (2007). Super learner. Statistical Applications in Genetics and Molecular Biology, 6(1).
van der Laan, M. J., and Rose, S. (2011). Targeted Learning: Causal inference for observational and experimental data. Springer-Verlag New York.
n <- 100
X <- data.frame(X1 = rnorm(n), X2 = rbinom(n, size = 1, prob = 0.5))
S0 <- function(t, x) pexp(t, rate = exp(-2 + x[,1] - x[,2] + .5 * x[,1] * x[,2]), lower.tail = FALSE)
T <- rexp(n, rate = exp(-2 + X[,1] - X[,2] + .5 * X[,1] * X[,2]))
G0 <- function(t, x) {
as.numeric(t < 15) * .9 * pexp(t, rate = exp(-2 -.5 * x[,1] - .25 * x[,2] + .5 * x[,1] * x[,2]), lower.tail=FALSE)
}
C0 <- rbinom(n, 1, .1)
C <- rexp(n, exp(-2 -.5 * X[,1] - .25 * X[,2] + .5 * X[,1] * X[,2]))
C[C0 == 1] <- 0
C[C > 15] <- 15
time <- pmin(T, C)
event <- as.numeric(T <= C)
event.SL.library <- cens.SL.library <- lapply(c("survSL.km", "survSL.coxph", "survSL.expreg", "survSL.weibreg", "survSL.loglogreg", "survSL.gam", "survSL.rfsrc"), function(alg) {
c(alg, "survscreen.glmnet", "survscreen.marg", "All")
})
fit <- survSuperLearner(time = time, event = event, X = X, newX = X, new.times = seq(0, 15, .1), event.SL.library = event.SL.library, cens.SL.library = cens.SL.library, verbose = TRUE)
fit$event.coef[which(fit$event.coef > 0)]
fit$cens.coef[which(fit$cens.coef > 0)]
plot(fit$event.SL.predict[1,], S0(t = seq(0, 15, .1), X[1,]))
abline(0,1,col='red')
plot(fit$cens.SL.predict[1,], G0(t = seq(0, 15, .1), X[1,]))
abline(0,1,col='red')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.