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

prep_data_long_surv fails on multi-event data #78

Closed
jburos opened this issue Jan 9, 2019 · 0 comments · Fixed by #79
Closed

prep_data_long_surv fails on multi-event data #78

jburos opened this issue Jan 9, 2019 · 0 comments · Fixed by #79

Comments

@jburos
Copy link
Member

jburos commented Jan 9, 2019

Related to #41 & #42, the current functionality of prep_data_long_surv for multi-event data (and thus for competing risks) is broken.

Here is a reproducible example:

data = survivalstan.sim.sim_data_jointmodel(N=200)
# following breaks
ldf = survivalstan.prep_data_long_surv(
  data['events'], 
  event_col = 'event_value', 
  event_name = 'event_name', 
  time_col = 'time',
  sample_col = 'subject_id')

Produces output:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-62-173ddbd763bc> in <module>
----> 1 ldf = survivalstan.prep_data_long_surv(data['events'], event_col = 'event_value', event_name = 'event_name', time_col = 'time', sample_col = 'subject_id')

~/projects/survivalstan/survivalstan/survivalstan.py in prep_data_long_surv(df, time_col, event_col, sample_col, event_name)
    652                            ].drop_duplicates().copy()
    653         assert(all(df_covars.duplicated(subset=[sample_col, time_col])
--> 654                    is False))
    655         df_multi = pd.merge(df_events, df_covars, on=[sample_col, time_col],
    656                             how='outer')

TypeError: 'bool' object is not iterable
jburos added a commit that referenced this issue Jan 9, 2019
@jburos jburos mentioned this issue Jan 10, 2019
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

Successfully merging a pull request may close this issue.

1 participant