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

pmf of betabinomial #1

Open
bgorissen opened this issue Dec 7, 2024 · 0 comments
Open

pmf of betabinomial #1

bgorissen opened this issue Dec 7, 2024 · 0 comments

Comments

@bgorissen
Copy link

It appears the term ln(n choose x) is missing from the log pmf calculation for the beta binomial distribution. You may want to rely on scipy.stats.betabinom.logpmf instead.

https://github.com/StatBiomed/BBMix/blob/master/bbmix/models/betabin_mix.py#L155C13-L155C25

            log_E_gammas[k] = np.log(pi) + gammaln(y + a) + gammaln(n - y + b) + gammaln(a + b) - \
                              (gammaln(a) + gammaln(b) + gammaln(n + a + b))

https://github.com/StatBiomed/BBMix/blob/master/bbmix/models/betabin_mix.py#L119

        return gammaln(y + a) + gammaln(n - y + b) + gammaln(a + b) - \
               (gammaln(a) + gammaln(b) + gammaln(n + a + b)) + np.log(pi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant