Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concordance_index_ipcw output inconsistent with survAUC package #428

Open
melodiemonod opened this issue Jan 17, 2024 · 1 comment
Open

Comments

@melodiemonod
Copy link

When there is a time-tie between an event and a censoring, the Uno C-index from sksurv-survival is not equal to that found with the survAUC package on R.

Reproducible example:

sksurv-survival with tie

import numpy as np
from sksurv.metrics import  concordance_index_ipcw

test_survival_time = np.array([11., 11., 26.,  89., 128., 299., 300.])
test_survival_status = np.array([1, 0, 0, 1, 0, 1, 0]) 
y_test = np.array(list(zip(test_survival_status, test_survival_time)), dtype=[('survival', '?'), ('futime', '<i8')])

risk_score = np.array([-0.02, 1.20, -0.56, -1.33, -0.81, 1.02, -1.29])

c_uno = concordance_index_ipcw(y_test, y_test, risk_score, tau= 299 )[0]
print(c_uno)

= 0.37426900584795325

survAUC with tie

library(survAUC)

futime = c(11,  11, 26,  89, 128, 299, 300)
fustat = c(1, 0, 0, 1, 0, 1, 0)
Surv.rsp.new = survival::Surv(futime, fustat)

lpnew = c(-0.02, 1.20, -0.56, -1.33, -0.81, 1.02, -1.29)

C_Uno = UnoC(Surv.rsp.new, Surv.rsp.new, lpnew, time =299)
print(C_Uno)

= 0.4129032

Note that without the tie, the results would be the same.

sksurv-survival without tie

test_survival_time_2 = np.array([11., 26.,  89., 128., 299., 300.])
test_survival_status_2 = np.array([1, 0, 1, 0, 1, 0]) 
y_test_2 = np.array(list(zip(test_survival_status_2, test_survival_time_2)), dtype=[('survival', '?'), ('futime', '<i8')])

risk_score_2 = np.array([-0.02, -0.56, -1.33, -0.81, 1.02, -1.29])

c_uno_2 = concordance_index_ipcw(y_test_2, y_test_2, risk_score_2, tau= 299 )[0]
print(c_uno_2)

= 0.4129032258064516

survAUC without tie

futime_2 = c(11, 26,  89, 128, 299, 300)
fustat_2 = c(1, 0, 1, 0, 1, 0)
Surv.rsp.new_2 = survival::Surv(futime_2, fustat_2)

lpnew = c(-0.02, -0.56, -1.33, -0.81, 1.02, -1.29)

C_Uno_2 = UnoC(Surv.rsp.new_2, Surv.rsp.new_2, lpnew, time =299)
print(C_Uno_2)

= 0.4129032

@sebp
Copy link
Owner

sebp commented Jan 17, 2024

Thanks for reporting this issue.

Interestingly, the reference implementation in R by Hajime Uno gives yet another result:

library(survC1)

futime = c(11,  11, 26,  89, 128, 299, 300)
fustat = c(1, 0, 0, 1, 0, 1, 0)
lpnew = c(-0.02, 1.20, -0.56, -1.33, -0.81, 1.02, -1.29)

C_est = Est.Cval(cbind(futime, fustat, lpnew), tau = 299, nofit = TRUE)
print(C_est$Dhat)

= 0.3514874

If the tied time point consists only of events (fustat[2] = 1), all implementations agree (= 0.612766). Therefore, it seems that the estimator of the censoring distribution differs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants