Learn R Programming

survival (version 3.5-8)

brier: Compute the Brier score for a Cox model

Description

Compute the Brier score, for a coxph model

Usage

brier(fit, times, newdata, ties = TRUE, detail = FALSE, timefix = TRUE, 
      efron = FALSE)

Value

a list with components

rsquared

the \(R^2\) value, a scaled Brier score. This will be a vector with one entry for each time point.

brier

the brier score, a vector with one entry per time point

times

the time points at which the score was computed

Arguments

fit

result of a coxph fit

times

time points at which to create the score

newdata

optional, used to validate a prior fit with new data

ties

if TRUE, treate tied event/censoring times properly

detail

if TRUE, the returned object has more detail. This can be useful for debugging or for instruction.

timefix

deal with near ties in the data. See the tied times vignette.

efron

use the same survival estimate for the NULL model as was used in the coxph call

Author

Terry Therneau

Details

Far more details are found in the vignette. At any time point tau, the scaled Brier score is essentially the R-squared statistic where y = the 0/1 variable "event at or before tau", yhat is the probability of an event by tau, as predicted by the model, and the ybar is the predicted probablity without covariate, normally from a Kaplan-Meier. If \(R^2= 1- \sum(y- \hat y)^2/\sum (y- \mu)^2\), the Brier score is formally only the numerator of the second term. The rescaled value is much more useful, however.

Many, perhaps even most algorithms do not properly deal with a tied censoring time/event time pair. The tied option is present mostly verify that we get the same answer, when we make the same mistake. The numerical size of the inaccuracy is very small; just large enough to generate concern that this function is incorrect.

A sensible argument can be made that the NULL model should be a coxph call with no covariates, rather than the Kaplan-Meier; but it turns out that the effect is very slight. This is allowed by the efron argument.

See Also

rttright

Examples

Run this code
cfit <- coxph(Surv(rtime, recur) ~ age + meno + size + pmin(nodes,11), 
              data= rotterdam)
round(cfit$concordance["concordance"], 3)  # some predictive power
brier(cfit, times=c(4,6)*365.25)   # values at 4 and 6 years

Run the code above in your browser using DataLab