You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
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.)
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.
Activity
josef-pkt commentedon Apr 14, 2016
for using scale to get overdispersion: Kerby had used it already http://nbviewer.jupyter.org/urls/umich.box.com/shared/static/0lgt5635uo6rhakjj9d5.ipynb
see also https://groups.google.com/d/msg/pystatsmodels/F_gshgZarg0/zfzrw-3CBwAJ
followup monologue refers to this issue
notebook link https://gist.github.com/josef-pkt/ff08f8c446576faa3654d17694da01fc
for exog dependent overdispersion
minor bug:
scale checks isinstance float and breaks with integer scale, i.e. I tried
scale=1with NegativeBinomialjosef-pkt commentedon Nov 23, 2016
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.)
josef-pkt commentedon Sep 30, 2018
correction this this, see #5277
the default scale in GLM NegativeBinomial might have changed during scale cleanup
josef-pkt commentedon Sep 30, 2018
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
bashtage commentedon Jul 30, 2026
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.