This function subtracts the C/D AUC metric from one to obtain a loss function whose lower values indicate better model performance (useful for permutational feature importance)

loss_one_minus_cd_auc(y_true = NULL, risk = NULL, surv = NULL, times = NULL)

Arguments

y_true

a survival::Surv object containing the times and statuses of observations for which the metric will be evaluated

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

Value

a numeric vector of length equal to the length of the times vector, each value (from the range from 0 to 1) represents 1 - AUC metric at a specific time point, with lower values indicating better performance.

#' @section References:

  • [1] Uno, Hajime, et al. "Evaluating prediction rules for t-year survivors with censored regression models." Journal of the American Statistical Association 102.478 (2007): 527-537.

  • [2] Hung, Hung, and Chin‐Tsang Chiang. "Optimal composite markers for time‐dependent receiver operating characteristic curves with censored survival data." Scandinavian Journal of Statistics 37.4 (2010): 664-679.

See also

Examples

library(survival)
library(survex)

cph <- coxph(Surv(time, status) ~ ., data = veteran, model = TRUE, x = TRUE, y = TRUE)
cph_exp <- explain(cph)
#> Preparation of a new explainer is initiated 
#>   -> model label       :  coxph (  default  ) 
#>   -> data              :  137  rows  6  cols (  extracted from the model  ) 
#>   -> target variable   :  137  values ( 128 events and 9 censored , censoring rate = 0.066 ) (  extracted from the model  ) 
#>   -> times             :  50 unique time points , min = 1.5 , median survival time = 80 , max = 999 
#>   -> times             :  (  generated from y as uniformly distributed survival quantiles based on Kaplan-Meier estimator  ) 
#>   -> predict function  :  predict.coxph with type = 'risk' will be used (  default  ) 
#>   -> predict survival function  :  predictSurvProb.coxph will be used (  default  ) 
#>   -> predict cumulative hazard function  :  -log(predict_survival_function) will be used (  default  ) 
#>   -> model_info        :  package survival , ver. 3.7.0 , task survival (  default  ) 
#>   A new explainer has been created!  

y <- cph_exp$y
times <- cph_exp$times
surv <- cph_exp$predict_survival_function(cph, cph_exp$data, times)

loss_one_minus_cd_auc(y, surv = surv, times = times)
#>  [1] 0.3407407 0.1954545 0.1647287 0.2153333 0.2154472 0.2588235 0.2493310
#>  [8] 0.2371542 0.2017857 0.1848485 0.1512477 0.1487721 0.1666667 0.1703297
#> [15] 0.1834586 0.1915459 0.1815603 0.2073563 0.1754268 0.1607143 0.1594959
#> [22] 0.1769892 0.1735873 0.1808102 0.1567164 0.1624572 0.1545455 0.1514622
#> [29] 0.1646451 0.1765517 0.1966903 0.2089443 0.2235589 0.2169021 0.2169967
#> [36] 0.2198744 0.2035910 0.2123244 0.2175000 0.2356979 0.2298851 0.2147059
#> [43] 0.2224044 0.2183623 0.2150072 0.1850775 0.1310433 0.1879699 0.1259259
#> [50]       NaN