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))
Run the code above in your browser using DataLab