Problem with NaN in the dataset using CoxTimeVaryingFitter #1435
              
                Unanswered
              
          
                  
                    
                      Asieh-A-Mofrad
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm new to survival analysis and the lifelines library.
I'm using Cox’s time varying proportional hazard model and trying to use the CoxTimeVaryingFitter. My data has several time-varying covariates and is in the event-based type (i.e. NaN represents if an event is not happening).
When I create the dataset based on the lifelines guideline using
lifelines.utils.covariates_from_event_matrix(), The final dataset has NaN in the first period of each event. It is in line with the example in the guideline:But when I use this dataset as the input to the fit, I got the error:
NaNs were detected in the dataset. Try using pd.isnull to find the problematic values.PS. If I remove the rows with NaNs, the fitter works, but in this case, I miss some data, similar to the data for id=2 in the example, and none of the time periods starts at time 0.
Thanks in advance,
Asieh
Beta Was this translation helpful? Give feedback.
All reactions