I am trying to do logisitc regression, but have this issue - some of the p values are NaN

model = sm.Logit(y2,X2.astype(float))
result = model.fit()

enter image description here enter image description here

Any ideas what to do?

  • 1
    $\begingroup$ I've never used this package but my guess would be that there's a problem with these 4 variables about the time of day in the data. The main problem is not that the p-values are NaN, this is probably just a consequence of the first error "maximum likelihood failed to converge". Check the format of your data, in particular the type of these variables: they should be numerical I assume. It looks as if it doesn't find any value for these variables. $\endgroup$ – Erwan Jan 20 at 23:40
  • $\begingroup$ I think, this might be useful - stackoverflow.com/a/55556806/8675216 $\endgroup$ – Akash Dubey Jan 22 at 21:03
  • $\begingroup$ They are numerical, but it can be that there are many 0's, so the article that @AkashDubey recommend could be good, I will try some other methods for logit. $\endgroup$ – Sim_Demo Jan 23 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.