Skip to content

BUG?: GLM working residuals #2891

Closed

Description

@thequackdaddy

Wanted to document this in a separate issue.

There is some discussion in #2872 about working residuals. I believe there is an error with our derivation.

Currently, the code is...

    def resid_working(self):
        # Isn't self.resid_response is already adjusted by _n_trials?
        val = (self.resid_response / self.family.link.deriv(self.mu))
        val *= self._n_trials
        return val

I suggest it really ought to be...

    def resid_working(self):
        val = (self.resid_response * self.family.link.deriv(self.mu))
        return val

This change breaks some unit tests... @josef-pkt found this link (see page 6) which shows we should multiply, not divide, by the derivative.

(For the record, I don't use working residuals, nor do I plan to start using them. But I feel bad about writing a test in #2872 with an intentionally incorrect result to match what I think is incorrect.)

Thanks!

Activity

  1. josef-pkt commented on Apr 13, 2016

    @josef-pkt
    Member

    skip testing the working residuals. That's what I do in the weights testing PR.
    I added the verified results but did not add an assert for them, so I can add it later.

    The problem is that we need to redo the current unit test results which have coded the wrong numbers. If we just fix the bug, then the unit tests will fail. (all residuals are combined together so it's not so easy just to replace the incorrect working residuals in the test results file.)

  2. thequackdaddy commented on Apr 13, 2016

    @thequackdaddy
    MemberAuthor

    Yes sir. Thanks!

  3. added this to the 0.8 milestone on May 3, 2016
  4. added 2 commits that reference this issue on Aug 16, 2016
    24c6c5a
    75b45d6
  5. added a commit that references this issue on Jan 27, 2017
    6c481f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions