Skip to content

BUG: hessian_factor in GLM has wrong sign as derivative #7826

Open

Description

@josef-pkt

edit this is essentially a duplicate of #4714, problem is also in OLS

I'm running into problems with sign convention for hessian_factor and discete/MLE models

hessian_factor should correspond to the second derivative, however GLM reverses the sign to make hessian factor positive.

in PR #7825 I need to reverse the sign for GLM for score_tests
https://github.com/statsmodels/statsmodels/pull/7825/files#diff-f12277aa8b6608078f5075e33fd09d2df74bd8c54bf7c34c7a7c99cc150abc55R221

however MLEInfluence follows the convention of GLM and uses positive hessian_factor

Changing sign GLM.hessian_factor is not backwards compatible, but there might be only minimal use of it by users.

Activity

  1. added this to the 0.14 milestone on Oct 28, 2021
  2. josef-pkt commented on Oct 29, 2021

    @josef-pkt
    MemberAuthor

    I just saw that GLM.information also has the wrong sign.
    It returns the hessian, but information matrix is negative hessian.

    This has also been added in 2014 https://github.com/statsmodels/statsmodels/pull/1781/files#diff-388bc0dcdcd2e88f19d0d08e3269a448719fcba4811cc5eaa0db1c0a2ec911f2R426

    Obviously I wasn't much aware of signs of hessian verus IM when I wrote that.
    No bug report since then, and we never use GLM.information. Remove it.

  3. josef-pkt commented on Dec 5, 2022

    @josef-pkt
    MemberAuthor

    refactor for early 0.15

    will need changes to generic code that currently special cases GLM

  4. modified the milestones: 0.14, 0.15 on Dec 5, 2022
  5. added
    type-bug-wrong
    on Sep 28, 2026
  6. added a commit that references this issue on Oct 28, 2026
    a146ffb
  7. bashtage commented on Oct 28, 2026

    @bashtage
    Member

    Reopening. #10628 changed GLM.information to return the expected (Fisher) information with the correct sign, and the closing keyword in the author's commit message closed this issue when it was merged. The sign convention of hessian_factor, which is what this issue is about, is unchanged, so the issue is only partly resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backwards-incompatcomp-genmodprio-elevtype-bugtype-bug-wrongtype-refactor

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions