Repository navigation
Discrete scorefactor offset rebased3 - #7825
Conversation
| fit_constrained.__doc__ = fit_constrained_wrap.__doc__ | ||
|
|
||
| def _derivative_predict(self, params, exog=None, transform='dydx', | ||
| offset=None): |
There was a problem hiding this comment.
offset before transform ?
|
|
||
| return res | ||
|
|
||
| get_prediction.__doc__ = pred.get_prediction_glm.__doc__ |
There was a problem hiding this comment.
this has been replaced by appender
delete
|
test failures in statsmodels.stats.tests.test_influence.TestInfluenceLogitCompare and related Poisson I guess hessian_factor has the wrong sign for this function. maybe GLM started the wrong sign convention for hessian_factor a few pep-8 |
|
This pull request introduces 9 alerts when merging 9cd2202 into 088a792 - view on LGTM.com new alerts:
|
|
This pull request introduces 8 alerts when merging 4a6526d into 088a792 - view on LGTM.com new alerts:
|
4a6526d to
d5ad98e
Compare
|
test_sandwich_cov.TestGLMPoisson fails on some runs, just a bit worse than rtol. |
|
Poisson.fit_constrained has much more code than the new BinaryModel.fit_constrained Can the Poisson method also use more of the generic code? No unit tests for Probit fit_constrained. (all inherited) generic fit constrained is not yet supported for models with extra params as in NB and GPP |
|
This pull request introduces 8 alerts when merging d5ad98e into 088a792 - view on LGTM.com new alerts:
|
|
monte carlo results in old pr #5711 (comment) I will need to verify implementation by MonteCarlo. Not much of robust score_tests is in other packages. update cases are second block is null of correctly specified mean function. However previous PR comment had larger sample size at nobs=1000 (with 1000 replication) The score_test in the MC is a reset test for GLM-Poisson: update 2 running nobs=1000 and nrepl=1000 as in the previous pr comment update 3 running the same nobs=1000 and nrepl=1000 HC rejects a bit more often with Poisson than with GLM-Poisson. possible difference: default optimizer is irls and eim in GLM, and newton and oim in Poisson Overall results look closely what we would expect based on the theory. |
|
sign of hessian factor still needs more review update The code in score_test/ |
|
score_test for models with extra params, e.g. NBP using exog_extra directly raises shape error because score_factor is 2d (2 components nobs=500, DGP in notebook uses normal random effect to introduce overdispersion. The wald and score test versions of the reset test are very close to each other, with nobs = 50: with nobs=5000 The same works for GeneralizedPoisson with similar results update All tests use nonrobust, even though there is overdispersion in the dgp. DGP without overdispersion, i.e. without normal random effect |
|
score_test has a score test pvalues are at around 0.9 trying some more: Maybe that was the idea to add that in the first place. I just don't remember the details here. I went through this before. links? references? |
|
other versions in
|
|
In my notebook, the fittedvalues for reset test is wrong and inconsistent. GLM fittedvalues is mu |
|
Most likely wrong: GLM score_test with with Related usage question: If we use freq_weights for IPW, what should be the result?
|
|
Nice GLM-Binomial two sample case compared with specific hypothesis test diff in p-value is 1.6e-11 In binary case we cannot have excess dispersion, so HC0 cannot help I'm not sure what this means, maybe some heteroscedasticity across groups aside scale according to pearson chi2 is not 1 because of df correction correction |
|
agreement is even better with Poisson: same as binomial example only with family Poisson, endog is still zeros and ones. difference of HC0 is larger here. case is under dispersed according to pearson chi2 |
|
It doesn't match up closely between GLM gaussian score_test and OLS compare_lm_test still the same 2-sample case AFAICS RegressionResults.compare_lm_test uses the scale of the update AFAICS now, the only difference in nonrobust lm/scoretest is the df-correction in the scale estimate
|
|
looks good enough and works well, merge when green |
|
This pull request introduces 1 alert and fixes 3 when merging 37763f2 into 59c41e8 - view on LGTM.com new alerts:
fixed alerts:
|
37763f2 to
3e272b4
Compare
|
This pull request fixes 7 alerts when merging 3e272b4 into 59c41e8 - view on LGTM.com fixed alerts:
|
rebased version of #5711
no code removed (like NB, GPP score factor in first commit)
Logit score_factor is already in main
possible problems
sign of hessian factor, not sure how GLM and discrete really compare
docstrings need review, Resolving merge conflicts might not have left good docstrings.
duplicate shortcut name for
base._parameter_inferenceinferandpinf`included in PR: