You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
beta_binomial_lpmf is unstable for large shape arguments #2508
The values should converge towards binomial_lpmf(500, 1000, 0.5) = -3.67992.
Current Version:
v4.1.0
Proposed solution
It is possible that a similar trick to the one used in lbeta would be needed - compute separately a stirling approximation to the gamma functions involved, simplify analytically and then add corrections via lgamma_stirling_diff.
I'll try to start a PR with some tests demonstrating the problematic behaviour
Activity
wds15 commentedon Nov 19, 2024
The log cdf functions of the beta binomial are also unstable. The below function is a direct call to the respective Stan math function:
avehtari commentedon Oct 8, 2026
This is partially addressed by #3434 (not yet merged)