Concordance index errors with repeated events
See original GitHub issueThe following produces a nan
value in lifelines version 0.9.1.0
.
>>> import lifelines
>>> import numpy as np
>>> from lifelines.utils import concordance_index
>>> times = np.arange(3)
>>> events = np.ones(3)
>>> concordance_index(events, times)
nan
I don’t think that’s the expected outcome, it should be 0.5, right?
The same error happens when n=1
. In this case, I think a ValueError
should be thrown for input validation though.
>>> import lifelines
>>> import numpy as np
>>> from lifelines.utils import concordance_index
>>> times = np.arange(1)
>>> events = np.ones(1)
>>> concordance_index(events, times)
nan
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
A C-index for Recurrent Event Data - NCBI - NIH
We propose a C-index (index of concordance) applicable to recurrent event data. The present work addresses the dearth of measures for ...
Read more >A C-index for recurrent event data - Deep Blue Repositories
We propose a C-index (index of concordance) applicable to recurrent event data. The present work addresses the dearth of measures for quantifying a...
Read more >Use of the concordance index for predictors of censored ...
The concordance index is routinely used to measure how well a variable predicts the time to a censored event. However, current estimators depend...
Read more >Concordance for Survival Time Data
Concordance, or synonymously the C-statistic, is a valuable measure of model discrimination in analyses involving survival time data.
Read more >The Concordance Index decomposition A measure for a ...
The C-index can be decomposed into two parts; one to measure the relative ordering of cases with observed events and another to measure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@CamDavidsonPilon , I realised on trying to reproduce the bug, the issue was due to having some NaNs in the actual Time To Event column when the input is a DataFrame. This doesn’t really make it a use case for the function anymore but maybe the input error isn’t being handled correctly. I believe this would reproduce the error at least on my machine. `test1= pd.DataFrame(np.random.randint(800, size=800), columns=[‘prediction’])
test2= pd.DataFrame(np.random.randint(800, size=800), columns=[‘actuals’])
test2[-50:-1]=np.nan
print(test1.shape)
print(test2.shape)
print(lf.utils.concordance_index(test2, test1))`
So I’ve added an ZeroDivisionError to the latest version of pypi, 0.9.2. I’ve left the c-index as is, according to the second paper there.