expSurv {biospear}R Documentation

Computation of expected survival based on a prediction model

Description

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.

Usage

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, ...)

Arguments

res

an object of class 'resBMsel' generated by BMsel.

traindata

the data.frame used to compute the res object (training set).

method

selection method to compute. If missing, all methods contained in res are computed.

ci.level

the nominal level for the two-sided confidence interval (CI) of the survival probability.

boot

logical value: TRUE = boostraped CI, FALSE = analytical CI.

nboot

number of bootstrap replicates (only used when boot=TRUE).

smooth

logical value indicating if smoothed B-splines should be computed.

pct.group

number or percentile of the prognostic-risk 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 'resexpSurv' generated by expSurv.

newdata

data.frame containing new patients data. newdata must have the same variables as traindata.

pr.group

parameter for the plot() indicating the number of the prognostic-risk group for which the plot will be printed.

print.ci

logical parameter for the plot() indicating if CI will be printed.

xlim, ylim, xlab, ylab

usual parameters for plot.

...

other paramaters for predict or plot.

Details

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 non-parametric bootstrap approach (boot = TRUE). Smoothed B-splines (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().

Value

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.

Author(s)

Nils Ternes, Federico Rotolo, and Stefan Michiels
Maintainer: Nils Ternes nils.ternes@yahoo.com

Examples

########################################
# 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", "lasso-pcvl"), 
    inter = FALSE, 
    folds = 5)
  
  esurv <- expSurv(
    res = resBM,
    traindata = sdata,
    boot = FALSE,
    time = 5,
    trace = TRUE)
  plot(esurv, method = "lasso-pcvl")

## 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", "lasso-pcvl"), 
    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", "lasso-pcvl"))

  esurv <- expSurv(
    res = resBM,
    traindata = Breast,
    boot = FALSE,
    smooth = TRUE,
    time = 4,
    trace = TRUE
  )
  plot(esurv, method = "lasso")


## End(Not run)

########################################
########################################

[Package biospear version 1.0.2 Index]