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

test in links require exact class so Logit can't work in place of logit #2036

brentp opened this issue Oct 9, 2014 · 1 comment


None yet
2 participants
Copy link

commented Oct 9, 2014

Since logit is a subclass of Logit and the test is for isinstance(link, links), then class attribute links must always have the parent class because Logit is not an instance of logit.

This could be fixed by :

  • using logit = Logit in instead of subclassing
  • using Logit in place of logit in Binomial.links (and never using subclass anywhere else)
  • change test to check issubclass instead of isinstance

Below is the code to reproduce:

from statsmodels.api import GLM
from statsmodels.genmod.families import Binomial
from statsmodels.genmod.families.links import Logit, logit

import numpy as np

x = np.random.randn(15)
y = np.zeros_like(x)

# this works
print GLM(x, y, family=Binomial(link=logit))

# this doesnt
print GLM(x, y, family=Binomial(link=Logit))

This comment has been minimized.

Copy link

commented Oct 9, 2014

I'm closing as duplicate of #1509
see PR #1880 which doesn't fix the check, but allows users to turn it off

searching for the issue I also found #28 which might be one of our oldest issues (2009)

@josef-pkt josef-pkt closed this Oct 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.