Description Usage Arguments Value Author(s) References See Also Examples
Ridge or Lasso penalized regression.
Usually, this function is not called directly but embedded in a call to customSurv
from the main package survHD
(see examples).
1 | customPenalized(Xlearn, Ylearn, learnind, ...)
|
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 to be passed to function
|
An object of class ModelLearned
.
Levi Waldron lwaldron@hsph.harvard.edu Christoph Bernau bernau@ibe.med.uni-muenchen.de Martin Slawski ms@cs.uni-sb.de Anne-Laure Boulesteix boulesteix@ibe.med.uni-muenchen.de
Goeman, J.J. (2010) L1 Penalized Estimation in the Cox Proportional Hazards Model, Biometrical Journal, 52, 70-84
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 28 | ##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.penalized <- customSurv(X=beerX,y=beerY, learnind=learnind, penalty="ridge", lambda=100,customSurvModel=customPenalized)
##linear risk score
predict(fit.penalized@model,newdata=beerX[testind,],type='lp')
##survival probabilities at each uncensored time
mytimegrid <- sort(c(0.0,beerY[beerY[,2]==1,1]))
SurvivalProbs <- predict(fit.penalized,beerX[testind,],type='SurvivalProbs',timegrid=mytimegrid,gbm=TRUE)@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.