sbrier                 package:ipred                 R Documentation

_M_o_d_e_l _F_i_t _f_o_r _S_u_r_v_i_v_a_l _D_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

     Model fit for survival data: the integrated Brier score for
     censored observations.

_U_s_a_g_e:

     sbrier(obj, pred, btime=c(0, max(obj[,1])))

_A_r_g_u_m_e_n_t_s:

     obj: an object of class 'Surv'.

    pred: predicted values. Either a probability or a list of 'survfit'
          objects. 

   btime: numeric vector of times, the integrated Brier score is
          computed if this is of 'length > 1'.  The Brier score at
          'btime' is returned otherwise.

_D_e_t_a_i_l_s:

     There is no obvious criterion of model fit for censored data. The
     Brier score for censoring as well as it's integrated version were
     suggested by Graf et al (1999).

_V_a_l_u_e:

     The (integrated) Brier score with attribute 'time' is returned.

_R_e_f_e_r_e_n_c_e_s:

     Erika Graf, Claudia Schmoor, Willi Sauerbrei and Martin Schumacher
     (1999), Assessment and comparison of prognostic classification
     schemes for survival data. _Statistics in Medicine_ *18*(17-18),
     2529-2545.

_E_x_a_m_p_l_e_s:

     data(DLBCL)
     smod <- Surv(DLBCL$time, DLBCL$cens)

     KM <- survfit(smod)
     # integrated Brier score up to max(DLBCL$time)
     sbrier(smod, KM)

     # integrated Brier score up to time=50
     sbrier(smod, KM, btime=c(0, 50))

     # Brier score for time=50
     sbrier(smod, KM, btime=50)

     # a "real" model: one single survival tree with Intern. Prognostic Index
     # and mean gene expression in the first cluster as predictors
     mod <- bagging(Surv(time, cens) ~ MGEc.1 + IPI, data=DLBCL, nbagg=1)

     # this is a list of survfit objects (==KM-curves), one for each observation
     # in DLBCL
     pred <- predict(mod, newdata=DLBCL)

     # integrated Brier score up to max(time)
     sbrier(smod, pred)

     # Brier score at time=50
     sbrier(smod, pred, btime=50)
     # artificial examples and illustrations

     cleans <- function(x) { attr(x, "time") <- NULL; names(x) <- NULL; x }

     n <- 100
     time <- rpois(n, 20)
     cens <- rep(1, n)

     # checks, Graf et al. page 2536, no censoring at all!
     # no information: \pi(t) = 0.5 

     a <- sbrier(Surv(time, cens), rep(0.5, n), time[50])
     stopifnot(all.equal(cleans(a),0.25))

     # some information: \pi(t) = S(t)

     n <- 100
     time <- 1:100
     mod <- survfit(Surv(time, cens))
     a <- sbrier(Surv(time, cens), rep(list(mod), n))
     mymin <- mod$surv * (1 - mod$surv)
     stopifnot(all.equal(cleans(a),sum(mymin)/max(time)))

     # independent of ordering
     rand <- sample(1:100)
     b <- sbrier(Surv(time, cens)[rand], rep(list(mod), n)[rand])
     stopifnot(all.equal(cleans(a), cleans(b)))



     # 2 groups at different risk

     time <- c(1:10, 21:30)
     strata <- c(rep(1, 10), rep(2, 10))
     cens <- rep(1, length(time))

     # no information about the groups

     a <- sbrier(Surv(time, cens), survfit(Surv(time, cens)))
     b <- sbrier(Surv(time, cens), rep(list(survfit(Surv(time, cens))), 20))
     stopifnot(all.equal(a, b))

     # risk groups known

     mod <- survfit(Surv(time, cens) ~ strata)
     b <- sbrier(Surv(time, cens), c(rep(list(mod[1]), 10), rep(list(mod[2]), 10)))
     stopifnot(a > b)

