expSurv {biospear}  R Documentation 
Based on a prediction model, this function computes expected survival for patients with associated confidence intervals. The returned object can be plotted to obtain a meaningful graphical visualization.
expSurv(res, traindata, method, ci.level = .95, boot = FALSE, nboot, smooth = TRUE, pct.group = 4, time, trace = TRUE, ncores = 1) ## S3 method for class 'resexpSurv' predict(object, newdata, ...) ## S3 method for class 'resexpSurv' plot(x, method, pr.group, print.ci = TRUE, xlim, ylim, xlab, ylab, ...)
res 
an object of class ' 
traindata 
the 
method 
selection method to compute. If missing, all methods contained in 
ci.level 
the nominal level for the twosided confidence interval (CI) of the survival probability. 
boot 
logical value: 
nboot 
number of bootstrap replicates (only used when 
smooth 
logical value indicating if smoothed Bsplines should be computed. 
pct.group 
number or percentile of the prognosticrisk groups. If a single number is provided, all the groups must be defined according to Cox (1957). If percentiles are provided, the sum must be 1 (e.g. 0.164, 0.336, 0.336, 0.164). 
time 
single time point to estimate the expected survival probabilities. 
trace 
logical parameter indicating if messages should be printed. 
ncores 
number of CPUs used (for the bootstrap CI). 
object, x 
an object of class ' 
newdata 

pr.group 
parameter for the 
print.ci 
logical parameter for the 
xlim, ylim, xlab, ylab 
usual parameters for plot. 
... 
Using an object of class 'resBMsel
' generated by BMsel
, expSurv
computes expected survival at a given time
and constructs confidence intervals thereof either with an analytical (boot
= FALSE
) or nonparametric bootstrap approach (boot
= TRUE
). Smoothed Bsplines (logical option smooth
) and categorization of the prognostic score into risk groups (using the option pct.group
) may be used to obtain a meaningful graphical visualization. Predictions for new patients (newdata
data frame) can be computed using predict()
. Graphical visualization can be obtained using plot()
.
A list
of length three containing the expected survival (surv
) and their corresponding confidence intervals (lower
and upper
). Each element of the list contains a matrix
of dimension number of patients x number of implemented methods.
Nils Ternes, Federico Rotolo, and Stefan Michiels
Maintainer: Nils Ternes nils.ternes@yahoo.com
######################################## # Simulated data set ######################################## ## Low calculation time set.seed(654321) sdata < simdata( n = 500, p = 20, q.main = 3, q.inter = 0, prob.tt = 0.5, alpha.tt = 0, beta.main = 0.8, b.corr = 0.6, b.corr.by = 4, m0 = 5, wei.shape = 1, recr = 4, fu = 2, timefactor = 1) resBM < BMsel( data = sdata, method = c("lasso", "lassopcvl"), inter = FALSE, folds = 5) esurv < expSurv( res = resBM, traindata = sdata, boot = FALSE, time = 5, trace = TRUE) plot(esurv, method = "lassopcvl") ## Not run: ## Moderate calculation time set.seed(123456) sdata < simdata( n = 500, p = 100, q.main = 5, q.inter = 5, prob.tt = 0.5, alpha.tt = 0.5, beta.main = c(0.5, 0.2), beta.inter = c(0.7, 0.4), b.corr = 0.6, b.corr.by = 10, m0 = 5, wei.shape = 1, recr = 4, fu = 2, timefactor = 1, active.inter = c("bm003", "bm021", "bm044", "bm049", "bm097")) resBM < BMsel( data = sdata, method = c("lasso", "lassopcvl"), inter = TRUE, folds = 5) esurv < expSurv( res = resBM, traindata = sdata, boot = TRUE, nboot = 100, smooth = TRUE, pct.group = 4, time = 5, ncores = 5) plot(esurv, method = "lasso", pr.group = 3) ## End(Not run) ######################################## # Breast cancer data set ######################################## ## Not run: data(Breast) dim(Breast) set.seed(123456) resBM < BMsel( data = Breast, x = 4:ncol(Breast), y = 2:1, tt = 3, inter = FALSE, std.x = TRUE, folds = 5, method = c("lasso", "lassopcvl")) esurv < expSurv( res = resBM, traindata = Breast, boot = FALSE, smooth = TRUE, time = 4, trace = TRUE ) plot(esurv, method = "lasso") ## End(Not run) ######################################## ########################################