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

BUG: Fix problems with predict handling offset and exposure #1679

Merged
merged 1 commit into from May 21, 2014

Conversation

Projects
None yet
2 participants
@kshedden
Copy link
Contributor

commented May 21, 2014

This PR accomplishes three things in GLM.predict:

  1. predict should ignore offset and exposure if exog is provided.
  2. If offset or exposure are explicitly provided, they should override any offset or exposure that were part of the fit.
  3. exposure is not allowed unless the link is the log function
@kshedden

This comment has been minimized.

Copy link
Contributor Author

commented May 21, 2014

Rephrasing #1 for clarity:

  1. predict should ignore offset and exposure from the fit if exog is provided

Also note that offset and exposure are new arguments.

offset = 0.

if exposure is not None and not isinstance(self.family.link,
families.links.Log):

This comment has been minimized.

Copy link
@josef-pkt

josef-pkt May 21, 2014

Member

just a comment and to add link to #1509 possible problems with instance checks


# Use fit exposure if appropriate
if exposure is None and exog is None and hasattr(self, 'exposure'):
# Already logged

This comment has been minimized.

Copy link
@josef-pkt

josef-pkt May 21, 2014

Member

Already in log. ? I was wondering for a while why we are logging https://docs.python.org/2/library/logging.html
minor

@josef-pkt

This comment has been minimized.

Copy link
Member

commented May 21, 2014

looks good to me

josef-pkt added a commit that referenced this pull request May 21, 2014

Merge pull request #1679 from kshedden/glm_predict_offset
BUG: Fix problems with predict handling offset and exposure in GLM

@josef-pkt josef-pkt merged commit ede3157 into statsmodels:master May 21, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@josef-pkt josef-pkt added PR labels May 21, 2014

@kshedden kshedden deleted the kshedden:glm_predict_offset branch Jun 9, 2014

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014

Merge pull request statsmodels#1679 from kshedden/glm_predict_offset
BUG: Fix problems with predict handling offset and exposure in GLM
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.