Repository navigation
BUG/ENH: discrete margins, handle extra param (e.g. NegativeBinomial) - #3811
Conversation
|
|
|
zero-inflated and hurdle models will be even more difficult with two sub-models for zero-modification and main model. |
|
I fixed eyex and eydx, but fixing the shape wherever it breaks is very "hacky" |
|
one possibility: use exog_idx as an index everywhere to make computation only with selected exog and params, better would be params_index. Using integer index instead of boolean has the advantage that the length doesn't matter, and we don't get shape mismatch if boolean mask and base array don't agree. params_index might help in the two-part model like zero-inflated models to select between inflation exog and main model exog. |
|
general: dummy_idx and count_idx are not attached to the margeff, so it is not visible which exog are treated as dummy or as count variables. |
bb9bd2c to
eb7cb20
Compare
|
amended last commit to fix also Note, randhie dataset does not have a count exog, but 'disea' works after rounding |
|
as reference: here is my gist to try out various results for genpoisson, and comparison to negbin |
1 similar comment
|
I think I want to merge the current version, or something close to it. Refactoring margins is too much for now, and would be better combined with the nonlinear prediction enhancement. This means that we don't support margins for zero-inflated and hurdle count models during this years GSOC. |
|
Note, margeff attribute is ndarray, not wrapped with pandas (similar to t_test ContrastResults) |
|
this has no unit tests yet. |
|
unit tests and comparison to Stata: It's the first time that I use margins in Stata, I don't see the Stata commands that were used to create unit test for margins. using cpunish data with Poisson and NegativeBinomial (I used it for GLM Poisson weights unit tests) Margins with continuous and dummy agree at several decimals. I haven't figured out the Stata equivalent of |
|
This pull request introduces 1 alert - view on lgtm.com new alerts:
Comment posted by lgtm.com |
|
fails on all travis, passes on appveyor, passes on my Windows. The problem is that the dataset is "difficult" and NegativeBinomial does not have hessian/cov_params available (not invertible). |
cc571bf to
0038b48
Compare
|
amended last commit and force pushed to change the example
appveyor has the unrelated ARMA failure. rebase and then merge. |
|
This pull request introduces 1 alert - view on lgtm.com new alerts:
Comment posted by lgtm.com |
0038b48 to
a49b574
Compare
|
This pull request introduces 1 alert - view on lgtm.com new alerts:
Comment posted by lgtm.com |
|
this is just one commit behind master, AFAICS. no more rebase needed, merging |
closes #3809
this is a quickly done fix based on the exceptions.
no unit tests yet, but results for default margeff of poisson, generalized poisson and negative binomial are in the same neighborhood in datasets.randhie example.
and similar for standard errors