brier_score {survex} | R Documentation |
Calculate Brier score
Description
A function for calculating the Brier score for a survival model.
Usage
brier_score(y_true = NULL, risk = NULL, surv = NULL, times = NULL)
loss_brier_score(y_true = NULL, risk = NULL, surv = NULL, times = NULL)
Arguments
y_true |
a |
risk |
ignored, left for compatibility with other metrics |
surv |
a matrix containing the predicted survival functions for the considered observations, each row represents a single observation, whereas each column one time point |
times |
a vector of time points at which the survival function was evaluated |
Details
Brier score is used to evaluate the performance of a survival model, based on the squared distance between the predicted survival function and the actual event time, weighted to account for censored observations.
Value
numeric from 0 to 1, lower scores are better (Brier score of 0.25 represents a model which returns always returns 0.5 as the predicted survival function)
References
[1] Brier, Glenn W. "Verification of forecasts expressed in terms of probability." Monthly Weather Review 78.1 (1950): 1-3.
[2] Graf, Erika, et al. "Assessment and comparison of prognostic classification schemes for survival data." Statistics in Medicine 18.17‐18 (1999): 2529-2545.
See Also
Examples
library(survival)
library(survex)
cph <- coxph(Surv(time, status) ~ ., data = veteran, model = TRUE, x = TRUE, y = TRUE)
cph_exp <- explain(cph)
y <- cph_exp$y
times <- cph_exp$times
surv <- cph_exp$predict_survival_function(cph, cph_exp$data, times)
brier_score(y, surv = surv, times = times)
loss_brier_score(y, surv = surv, times = times)