Description Usage Arguments Value Author(s) References See Also Examples
Constructs Random Survival Forests using the function rsf
.
Usually, this function is not called directly but embedded in a call to customSurv
from the main package survHD
(see examples).
1 |
Xlearn |
Gene expression data (a |
Ylearn |
Survival Response, an object of class |
learnind |
An index vector specifying the observations that
belong to the learning set. May be |
... |
Further arguments that shall be passed to function |
An object of class ModelLearned
.
Christoph Bernau bernau@ibe.med.uni-muenchen.de
Ishwaran, H., et al. (2008) Random Survival Forests, The Annals of Applied Statistics, 2, 841-860
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ##load example data
if(require(pensim)){
require(survHD)
require(survHDExtra)
data(beer.exprs,package="pensim")
data(beer.survival,package="pensim")
##create Surv object (y)
beerY <- with(beer.survival,Surv(os,status))
##create mini X matrix (only using first 200 genes)
beerX <- t(as.matrix(beer.exprs))
beerX <- beerX[,1:200]
colnames(beerX) <- make.names(colnames(beerX),unique=TRUE)
##scale everything for testing.
beerX <- scale(beerX)
##define training and test sets:
set.seed(4)
allind <- 1:nrow(beerX)
learnind <- sample(allind,size=round(length(allind)*9/10))
testind <- allind[-learnind]
##fit a model with ridge regression, and with L2 penalty equal to 100:
fit.rsf <- customSurv(X=beerX,y=beerY, learnind=learnind, ntree=50,customSurvModel=customRSF)
##linear risk score
##survival probabilities at each uncensored time
mytimegrid <- sort(c(0.0,beerY[beerY[,2]==1,1]))
SurvivalProbs <- predict(fit.rsf,beerX[testind,],type='SurvivalProbs',timegrid=mytimegrid,gbm=FALSE)@SurvivalProbs
plot(SurvivalProbs,xlab="Time", ylab="Probability of Survival")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.