Skip to content

BUG/Review GLM scale type negative binomial #2888

Closed

Description

@josef-pkt

Why does GLM negative binomial default to pearson estimate of overdispersion?

unit tests for GLM negative binomial use Committee which has reference number scale=0.385...

scaletype is set in fit i.e. possible problem if fit is called repeatedly with different scale types

AFAICS: we can use scale argument in fit to get cov_type dispersed through the choice of pearsnon or deviance dispersion estimate
Note: pearson dispersion is abbreviated with "X2" which would be better as pearson, dev might also be better spelled out as deviance.

AFAIK, there is currently no usage of choosing scale/scaletype in fit
My initial thought was to implement over/under dispersion through cov_type
-> merge scale into cov_type or keep separate?

Activity

  1. josef-pkt commented on Apr 14, 2016

    @josef-pkt
    MemberAuthor
  2. josef-pkt commented on Nov 23, 2016

    @josef-pkt
    MemberAuthor

    not sure about this:

    family NegativeBinomial.loglike ignores scale argument, AFAICS
    Poisson and Binomial allow scale argument for excess dispersion, i.e. quasi-loglikelihood. (It's full loglikelihood including the constant, the definition of quasi-loglikelihood usually drops the constant.)

  3. added this to the 0.10 milestone on Apr 17, 2018
  4. josef-pkt commented on Sep 30, 2018

    @josef-pkt
    MemberAuthor

    correction this this, see #5277
    the default scale in GLM NegativeBinomial might have changed during scale cleanup

  5. josef-pkt commented on Sep 30, 2018

    @josef-pkt
    MemberAuthor

    overall much of this has changed and been fixed in #3856
    PR comments have links to several gists to show new behavior, e.g. https://gist.github.com/josef-pkt/ae344b04b264ea3db02da9c363b6aa24

  6. bashtage commented on Jul 30, 2026

    @bashtage
    Member

    Fixed by PR #3856 (Revise loglike/deviance to correctly handle scale) and doc PR #5277: NegativeBinomial now defaults to fixed scale=1.0 (matching quasi-likelihood expectations, not Pearson dispersion), loglike_obs correctly divides by scale, and the integer-scale crash was fixed by an explicit scale = float(scale) cast in GLM.fit. Closing as fixed.

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