Skip to content

Move the beta, neg_binomial and student_t cdfs to the new grad_reg_inc_beta (part 3 of #3409) - #3490

Draft
SteveBronder wants to merge 1 commit into
stable-inc-beta-revfrom
stable-inc-beta-cdfs
Draft

SteveBronder wants to merge 1 commit into
stable-inc-beta-revfrom
stable-inc-beta-cdfs

Conversation

@SteveBronder

@SteveBronder SteveBronder commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Part 3 of 3 of the split of #3409. Stacked on part 2, #3489 (base stable-inc-beta-rev). #3433 follows this PR.

Summary

Moves the downstream cdfs onto the grad_reg_inc_beta of #3409. Each file gets the same edit: drop the precomputed digamma buffers and the beta(a, b) argument, and call grad_reg_inc_beta<GRAD_RIB::G1>, <GRAD_RIB::G2> or <GRAD_RIB::BOTH> for only the partials that are needed. beta_cdf now computes both shape partials in one root call instead of calling inc_beta_dda and inc_beta_ddb.

neg_binomial_cdf is larger than the others: it is rewritten in vectorized form, so review it on its own.

The values of the distributions do not change. Only the gradients change. The accuracy study and the benchmarks are in the description of #3409.

Files

  • beta_cdf, beta_lcdf, beta_lccdf
  • beta_proportion_lcdf, beta_proportion_lccdf
  • neg_binomial_cdf, neg_binomial_lcdf, neg_binomial_lccdf, neg_binomial_2_cdf
  • student_t_cdf, student_t_lcdf, student_t_lccdf
  • test/unit/math/rev/prob/beta_cdf_test.cpp (new): beta_cdf shape partials at the b ≫ a point, with both shapes as autodiff variables and with each shape alone.
  • test/unit/math/rev/prob/beta_cdf_log_test.cpp (new): beta_lcdf shape gradients at the NaN point, at the dropped-term point and at an integer shape.

Release notes

See #3409.

Checklist

  • Copyright holder: Aalto University

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

… cdfs

beta_cdf computes both shape partials in one root call. The lcdf and
lccdf functions call the GRAD_RIB overload for only the partials needed.
@SteveBronder
SteveBronder added this pull request to stack #3491 October 26, 2026 19:14
SteveBronder added a commit that referenced this pull request Oct 26, 2026
Moves this branch onto the split of #3409 (#3409, #3489, #3490). The
conflicts are resolved to the tree of these commits replayed onto
stable-inc-beta-cdfs.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant