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

UnivariateFitter subtract/divide return all NaNs when a label is specified #466

Closed
yanirs opened this issue May 23, 2018 · 3 comments
Closed

Comments

@yanirs
Copy link

yanirs commented May 23, 2018

For example, running this code:

from lifelines import KaplanMeierFitter
from lifelines.datasets import load_waltons

df = load_waltons()
ix = df['group'] == 'miR-137'

kmf1 = KaplanMeierFitter()
kmf1.fit(df['T'][~ix], df['E'][~ix], label='control')

kmf2 = KaplanMeierFitter()
kmf2.fit(df['T'][ix], df['E'][ix], label='miR-137')

kmf1.subtract(kmf2).head()

yields this DataFrame:

timeline  control miR-137
0.0 NaN NaN
6.0 NaN NaN
7.0 NaN NaN
9.0 NaN NaN
13.0 NaN NaN

But if we drop the labels, we get:

timeline KM_estimate
0.0 0.000000
6.0 0.029412
7.0 0.021660
9.0 0.109895
13.0 0.198130

Shouldn't the label be ignored by subtract/divide?

@CamDavidsonPilon
Copy link
Owner

Ah, that's a legit bug. Thanks for reporting!

@CamDavidsonPilon
Copy link
Owner

This was fixed in the latest version

@yanirs
Copy link
Author

yanirs commented May 24, 2018

Woohoo! Thanks!

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

No branches or pull requests

2 participants