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
QUESTION: sm.Logit fails, while sm.GLM with Binomial link does not #6644
Comments
The main reason for these kind of problems is different optimizers. We can change optimizer in discrete models like Logit to one that is more robust, e.g. "nm" or "bfgs". If it's just a problem away from the optimum, then running e.g newton after nm has converged (or after enough iteratiions in nm), will improve the estimator locally because it uses derivative information. |
Also, handling of edge cases is still partially different between GLM and discrete models, |
Thank you for your reply. I have several questions:
thanks beforehand! |
By default GLM fit with a scipy optimizer runs a few iterations of IRLS to get better starting values for the gradient based optimizers.
discrete models don't have the common framework to add IRLS generically, and adding it to individual models would require model specific work, which would just duplicate GLM. |
Describe the bug
This is more of a question, and maybe a potential issue (please, correct me where I am wrong)
I was trying to fit a simple
logit
model usingsm.Logit
approach but I was receiving this:Which, AFAIK means that my
endog
has some issues. So, I looked at it:However, when I am trying
sm.GLM(y, X, family = sm.families.Binomial(link = sm.families.links.logit()))
it works as expected:AFAIK, the results of
sm.Logit
andsm.GLM
withBinomial
link should beall_close
. If one works, why not the other?Code Sample, a copy-pastable example if possible
Because this is a potential question, no code samples are required I presume
Note: As you can see, there are many issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates.
Note: Please be sure you are using the latest released version of
statsmodels
, or a recent build ofmaster
. If your problem has been fixed in an unreleased version, you might be able to usemaster
until a new release occurs.Note: If you are using a released version, have you verified that the bug exists in the master branch of this repository? It helps the limited resources if we know problems exist in the current master so that they do not need to check whether the code sample produces a bug in the next release.
If the issue has not been resolved, please file it in the issue tracker.
Expected Output
Results
Output of
import statsmodels.api as sm; sm.show_versions()
[paste the output of
import statsmodels.api as sm; sm.show_versions()
here below this line]The text was updated successfully, but these errors were encountered: