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
{{ message }}
Repository navigation
BUG: incorrect pearson_chi2 with binomial counts #3612
something fishy, either I'm not thinking correctly, or the unit tests for pearson_chi2 are only regression tests. statsmodels.datasets.star98 has a two column endog, so this should be a Binomial with n_trials > 1.
> sum(residuals(m1, type = "pearson")^2)
[1] 4051.921
additional check, deviance and aic from the R glm summary are the same as in the unit tests (at least at the print precision that I see in R right now)
I was not thinking wrongly, the bug was fixed in 7631bba#diff-bacf4e7dec296273aba74b04be3c42f8 with an innocent sounding commit message
part of PR #3692 which also added the unit tests for pearson_chi2
(So it's not possible to replicate the bug with current master :)
Activity
josef-pkt commentedon Jul 30, 2017
gist https://gist.github.com/josef-pkt/3a9a493a96ecc4617ab4a13dc5ce94e5
starting at line 30
josef-pkt commentedon Mar 28, 2018
something fishy, either I'm not thinking correctly, or the unit tests for pearson_chi2 are only regression tests.
statsmodels.datasets.star98has a two column endog, so this should be a Binomial with n_trials > 1.???
josef-pkt commentedon Mar 28, 2018
Running the unit test example in R, script is in tests/results folder,
I get the same number as in the unit test for pearson chi2.
Note, R glm summary does not compute pearson chi2, but can compute pearson residuals
base on https://stats.stackexchange.com/questions/29653/how-can-i-compute-pearsons-chi2-test-statistic-for-lack-of-fit-on-a-logisti
additional check, deviance and aic from the R glm summary are the same as in the unit tests (at least at the print precision that I see in R right now)
josef-pkt commentedon Mar 28, 2018
results in Stata are also the same as in the unit tests
josef-pkt commentedon Mar 29, 2018
still weird, but not a bug_wrong
maybe (likely) I was doing or reading something in the wrong way
the example is binomial, and the numbers are close to Stata at pretty good precision given that we do nonlinear optimization.
aside we are using the same definition for AIC as R
from the test suite
self.aic_R = 6039.22511799josef-pkt commentedon Mar 29, 2018
removing labels related to
bug-wrongjosef-pkt commentedon Mar 29, 2018
I was not thinking wrongly, the bug was fixed in 7631bba#diff-bacf4e7dec296273aba74b04be3c42f8 with an innocent sounding commit message
part of PR #3692 which also added the unit tests for pearson_chi2
(So it's not possible to replicate the bug with current master :)
closing