alexpghayes / distributions3

Probability Distributions as S3 Objects
https://alexpghayes.github.io/distributions3/
Other
100 stars 16 forks source link

Support for zero-augmented Poisson distributions #80

Closed zeileis closed 2 years ago

zeileis commented 2 years ago

Alex @alexpghayes , as already mentioned in the discussion about the Poisson distribution vignette, I have now put together distributions3 support for the two standard zero-augmented Poisson distributions:

For both distributions I have added d/p/q/r functions for zipois and hpois, respectively, following the style of the corresponding pois functions. Then I have added ZIPoisson() and HurdlePoisson() constructors along with the corresponding methods following the style of Poisson(). This infrastructure will greatly facilitate working with probabilistic regression models based on these distributions.

alexpghayes commented 2 years ago

Wonderful, thank you!

zeileis commented 2 years ago

Perfect, thanks! 🎉

The next step would be to provide the same for the zero-augmented negative binomial distributions. This is pretty much straightforward, I just have to do the algebra to get the skewness and kurtosis (if I can) which might be tricky.

And then only the mean+size parameterization is left for the negative binomial in order to support the standard count regression distributions. Do you have any thoughts/preferences regarding this? I think it would be relatively straightforward to allow the same NegativeBinomial() creator function with either p + size or with mu + size because in the background the same d/p/q/r functions for the nbinomial are called. Should I have a stab at this?

alexpghayes commented 2 years ago

Sounds good to me!