tuneRSF {survivalSL} | R Documentation |
Tune a Survival Random Forest
Description
This function finds the optimal nodesize, mtry, and ntree parameters for a survival random forest tree.
Usage
tuneRSF(times, failures, group=NULL, cov.quanti=NULL,
cov.quali=NULL, data, nodesize, mtry, ntree)
Arguments
times |
The name of the variable related the numeric vector with the follow-up times. |
failures |
The name of the variable related the numeric vector with the event indicators (0=right censored, 1=event). |
group |
The name of the variable related to the exposure/treatment. This variable shall have only two modalities encoded 0 for the untreated/unexposed patients and 1 for the treated/exposed ones. The default value is |
cov.quanti |
The name(s) of the variable(s) related to the possible quantitative covariates. These variables must be numeric. |
cov.quali |
The name(s) of the variable(s) related to the possible qualitative covariates. These variables must be numeric with two levels: 0 and 1. A complete disjunctive form must be used for covariates with more levels. |
data |
A data frame for training the model in which to look for the variables related to the status of the follow-up time ( |
nodesize |
The values of the node size optimized over. |
mtry |
The numbers of variables randomly sampled as candidates at each split optimized over. |
ntree |
The numbers of trees optimized over. |
Details
The function runs the tune.rfsrc
function of the randomForestSRC
package.
Value
optimal |
The value of lambda that gives the minimum mean cross-validated error. |
results |
The data frame with the mean cross-validated errors for each lambda values. |
References
Ishwaran H. and Kogalur U.B. (2007). Random survival forests for R, Rnews, 7(2):25-31.
Examples
data(dataDIVAT2)
tune.model <- tuneRSF(times="times", failures="failures", data=dataDIVAT2,
cov.quanti=c("age"), cov.quali=c("hla", "retransplant", "ecd"),
nodesize=c(100, 250, 500), mtry=1, ntree=100)
tune.model$optimal # the estimated nodesize value
# The estimation of the training modelwith the corresponding lambda value
model <- LIB_RSF(times="times", failures="failures", data=dataDIVAT2,
cov.quanti=c("age"), cov.quali=c("hla", "retransplant", "ecd"),
nodesize=tune.model$optimal$nodesize, mtry=1, ntree=100)
# 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))