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
lccdf of beta overflows at reasonably normal values #3377
I am sorry for giving reference to Claude AI in advance, but it was flagged by it recently.
transformed data { real y =0.865169; }
generated quantities {
real lccdf =beta_lccdf(y | 1, 19); // -infreal truth =19*log1m(y); // -38.0709
}
Analytically that's beta_lccdf(y | 1, 19) = 19·log1m(x) = −38.07, entirely finite. Stan evaluates it as log(1 − inc_beta(...)), and (1−0.865)^19 = 3e-17 vanishes against 1.0 in double precision, so it returns log(0), which leads to initialization error.
Technically, I have also had similar problems working with log_diff_exp for _lcdf. So I replaced it with log(CDF1 - CDF2) and it worked quite fine.
Sorry if I disturbed you without a good reason in advance.
Thanks for this! This has come up in a few cdf functions and I think we need to do a bigger review of extreme values for all of them. This would be a nice thing for a swarm of claude agents to look at since it would just be researching extreme values for each distribution and putting those into our expect_ad testing framework.
Reacted by Andrei R. Akhmetzhanov and John Ashley Burgoyne
There are now 10+ open PRs (some of them are marked as drafts if they depend on other PRs) improving tens of distribution functions, so maybe that one will be fixed, too. If you find more problematic distribution functions, you can first use github search functionality to search stan-dev/math PRs and issues to check whether that distribution function is already covered. If you don't find it covered yet, then please create a new issue
Activity
SteveBronder commentedon Aug 28, 2026
Thanks for this! This has come up in a few cdf functions and I think we need to do a bigger review of extreme values for all of them. This would be a nice thing for a swarm of claude agents to look at since it would just be researching extreme values for each distribution and putting those into our
expect_adtesting framework.avehtari commentedon Oct 6, 2026
I have fix for this, but that fix depends on #3409. After that is merged, I can make a PR to fix this.
Also I have done a bigger review and I have other PRs waiting, but don't want to flood before earlier have been reviewed
avehtari commentedon Oct 6, 2026
Oh well, I made the PR. This is fixed by #3433 (not yet merged)
aakhmetz commentedon Oct 16, 2026
@avehtari I lost my conversation, but AI also flagged some other distributions not only beta
avehtari commentedon Oct 16, 2026
There are now 10+ open PRs (some of them are marked as drafts if they depend on other PRs) improving tens of distribution functions, so maybe that one will be fixed, too. If you find more problematic distribution functions, you can first use github search functionality to search stan-dev/math PRs and issues to check whether that distribution function is already covered. If you don't find it covered yet, then please create a new issue