| tune.ahazpen | R Documentation | 
Tuning of penalty parameters for the penalized semiparametric additive hazards model via cross-validation - or via non-stochastic procedures, akin to BIC for likelihood-based models.
tune.ahazpen(surv, X, weights, standardize=TRUE, penalty=lasso.control(),
             tune=cv.control(), dfmax=nvars, lambda, ...)
| surv | Response in the form of a survival object, as returned by the
function  | 
| X | Design matrix. Missing values are not supported. | 
| weights | Optional vector of observation weights. Default is 1 for each observation. | 
| standardize | Logical flag for variable standardization, prior to
model fitting. Parameter estimates are always returned on
the original scale. Default is  | 
| penalty | A description of the penalty function to be used for
model fitting. This can be a character string naming a penalty
function (currently  | 
| dfmax | Limit the maximum number of covariates included in the
model. Default is  | 
| lambda | An optional user supplied sequence of penalty parameters. Typical usage
is to have the 
program compute its own  | 
| tune | A description of the tuning method to be used. This can be
a character string naming a tuning control
function (currently  | 
| ... | Additional arguments to be passed to  | 
The function performs an initial penalized fit based on the
penalty supplied in penalty to obtain a  sequence of
penalty parameters. Subsequently, it selects among these an optimal penalty parameter based on
the tuning control function described in tune, see  ahaz.tune.control.
An object with S3 class "tune.ahazpen".
| call | The call that produced this object. | 
| lambda | The actual sequence of  | 
| tunem | The tuning score for each value of  | 
| tunesd | Estimate of the cross-validated standard error, if  | 
| tunelo | Lower curve =  | 
| tuneup | Upper curve =  | 
| lambda.min | Value of  | 
| df | Number of non-zero coefficients at each value of
 | 
| tune | The selected  | 
| penalty | The selected  | 
| foldsused | Folds actually used, if  | 
Gorst-Rasmussen, A. & Scheike, T. H. (2011). Independent screening for single-index hazard rate models with ultra-high dimensional features. Technical report R-2011-06, Department of Mathematical Sciences, Aalborg University.
ahaz.tune.control, plot.tune.ahazpen, ahazpen.
data(sorlie)
# Break ties
set.seed(10101)
time <- sorlie$time+runif(nrow(sorlie))*1e-2
# Survival data + covariates
surv <- Surv(time,sorlie$status)
X <- as.matrix(sorlie[,3:ncol(sorlie)])
# Training/test data
set.seed(20202)
train <- sample(1:nrow(sorlie),76)
test <- setdiff(1:nrow(sorlie),train)
# Run cross validation on training data
set.seed(10101)
cv.las <- tune.ahazpen(surv[train,], X[train,],dfmax=30)
plot(cv.las)
# Check fit on the test data
testrisk <- predict(cv.las,X[test,],type="lp")
plot(survfit(surv[test,]~I(testrisk<median(testrisk))),main="Low versus high risk")
# Advanced example, cross-validation of one-step SCAD
# with initial solution derived from univariate models.
# Since init.sol is specified as a function, it is
# automatically cross-validated as well
scadfun<-function(surv,X,weights){coef(ahaz(surv,X,univariate=TRUE))}
set.seed(10101)
cv.ssc<-tune.ahazpen(surv[train,],X[train,],
                     penalty=sscad.control(init.sol=scadfun),
                     tune=cv.control(rep=5),dfmax=30)
# Check fit on test data
testrisk <- predict(cv.ssc,X[test,],type="lp")
plot(survfit(surv[test,]~I(testrisk<median(testrisk))),main="Low versus high risk")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.