| sbrier {ipred} | R Documentation |
Model fit for survival data: the integrated Brier score for censored observations.
sbrier(obj, pred, btime=c(0, max(obj[,1])))
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. |
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).
The (integrated) Brier score with attribute time is returned.
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.
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)