-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
NegativeBinomial, ZeroInflatedPoisson, ZeroInflatedBinomial moments #5163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5163 +/- ##
==========================================
+ Coverage 78.02% 78.07% +0.04%
==========================================
Files 88 88
Lines 14123 14138 +15
==========================================
+ Hits 11020 11038 +18
+ Misses 3103 3100 -3
|
@theorashid Could you provide some context on the moments you choose for the ZeroInflated distributions. I checked and in V3 we were simply using the mode of the non-zero component. If I read correctly the moment you used for the ZeroInflatedPoisson is the truncated mean of the mixture, and I guess the same is the case for the ZeroInflatedBinomial? If that's the case, should we call the |
Sure, I used the mean specified in the class docstring. I then named and truncated them in accordance with their not-zero-inflated counterparts from #5150 (here, we don't call them truncated – just |
Right but in the ZeroInflatedPoisson it's no longer |
True. Although ZIP uses |
Yeah I think that's less confusing |
Thanks @theorashid just merged! Looking forward to your next PR |
I might be wrong here, but the mean for zero inflated binomial distribution looks incorrect. Since psi is expected proportion of binomial variates, the mean should have been psi * n * p |
I was confused as well. If you are correct, then the docstrings of the distribution are incorrect, because they mention (1-psi). Do you want to investigate what is going on @sagartomar? |
The docstrings mention that psi is the expected proportion from the binomial distribution. We have 2 options here. We can either change psi to 1-psi in the docstrings or 1-psi to psi in the get_moment function and also update the tests. I think that second option is better as that way the distribution will remain consistent with how other zero inflated distributions are defined in pymc. What do you think @ricardoV94 ? |
@sagartomar I think you are right. We should change the moment and the definition of the mean in the docstrings as that also has the (1-psi) in the equation. Do you want to open a PR for that? |
Yes, I'll open a PR. I am also working on the ZeroInflatedNegativeBinomial distribution. Is it okay to address both of these in the same PR or should I open separate PRs for both? |
Fine to do them in the same, but try to keep the changes in separate commits |
Add moments and tests for the below distributions as part of #5078:
This is my first PR (first time with pytest, rebasing etc – ah the bliss life of the end user) so please check carefully.