Skip to content
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

Revamp our negative binomial explanation #5300

Closed
canyon289 opened this issue Dec 31, 2021 · 10 comments
Closed

Revamp our negative binomial explanation #5300

canyon289 opened this issue Dec 31, 2021 · 10 comments

Comments

@canyon289
Copy link
Member

Description of your problem

Our explanation of negative binomial parametrisation is either confusing, or wrong, I don't know which.

More specifically the explanation of the mu parameter itself is confusing, I personally dont understand how poisson is being parameterized twice, both by gamma samples controlled by alpha, and mu

Stans documentation does a much better job explaining the effect of each parameter, perhaps we can incorporate some of their wording
https://mc-stan.org/docs/2_20/functions-reference/nbalt.html

image

@canyon289
Copy link
Member Author

From @junpenglao

It's because pymc is explaining the parameterzation with NegBino being Gamma Poisson mixture https://en.wikipedia.org/wiki/Negative_binomial_distribution#Gamma%E2%80%93Poisson_mixture, and Stan is explaining NegBino being overdispersed Poisson (https://en.wikipedia.org/wiki/Negative_binomial_distribution#Poisson_distribution and https://en.wikipedia.org/wiki/Negative_binomial_distribution#Overdispersed_Poisson)

@samO2I1
Copy link
Contributor

samO2I1 commented Jan 2, 2022

@canyon289 can I work on this issue?

@canyon289
Copy link
Member Author

Please do! Let us know how we can help

@samO2I1
Copy link
Contributor

samO2I1 commented Jan 3, 2022

@canyon289 can you please share the source code link?

@canyon289
Copy link
Member Author

@samO2I1
Copy link
Contributor

samO2I1 commented Jan 5, 2022

@canyon289 I am not able to understand that at which points Poisson is parameterized twice?

@canyon289
Copy link
Member Author

canyon289 commented Jan 6, 2022

The documentation somewhat confusingly describes

  • The poisson distribution is parametrized by the gamma distribution
  • The poisson distribution (somehow is also) parameterized by mu
  • The gamma distribution is parameterized by alpha

I've provided a directly link here. To be honest I don't know what the correct explanation is so I won't be able to provide much guidance there.
https://docs.pymc.io/en/v3/api/distributions/discrete.html#pymc3.distributions.discrete.NegativeBinomial

@herve-91
Copy link
Contributor

Hello

In the context, considered in the documentation, where the negative binomial is introduced as a poisson random variable whose rate is gamma distributed, I believe both and should be presented as parameters of the gamma distribution:

  • is the shape of the gamma distribution
  • is the mean of the gamma distribution.

Indeed, if we consider a poisson distribution whose rate is gamma distributed:

where
  • is a poisson distribution with rate

  • is a gamma distribution with shape parameter and rate parameter

We have:

from which we can recover the formula of the documentation if we replace by where is the mean of the gamma distribution :

Regards,

@canyon289
Copy link
Member Author

canyon289 commented Jan 16, 2022

This is great and much less confusing. Would you like to add some version of it the docs? Thank you for investigating!

@canyon289
Copy link
Member Author

Thanks @herve-91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants