probability icon indicating copy to clipboard operation
probability copied to clipboard

The inverse of the regularized incomplete beta function

Open leandrolcampos opened this issue 3 years ago • 4 comments

Hello TFP community,

I’d like to work on the implementation of the inverse of the regularized incomplete beta function (special.betaincinv in SciPy).

To do this, I plan to study the following references:

  • Majumder, Kantilal L., and G. P. Bhattacharjee. “Algorithm AS 64: Inverse of the incomplete beta function ratio.” Journal of the Royal Statistical Society. Series C (Applied Statistics) 22.3 (1973): 411-414. Link: https://www.jstor.org/stable/2346798.

  • Cran, G. W., K. J. Martin, and G. E. Thomas. “Remark as r19 and algorithm as 109: A remark on algorithms: As 63: The incomplete beta integral as 64: Inverse of the incomplete beta function ratio.” Journal of the Royal Statistical Society. Series C (Applied Statistics) 26.1 (1977): 111-114. Link: https://www.jstor.org/stable/2346887.

  • Berry, K. J., and P. W. Mielke. “A remark on algorithm AS 109: inverse of the incomplete beta function ratio.” Applied statistics 39.2 (1990): 309-310. Link: https://www.jstor.org/stable/2347779.

  • YouTube video “Newton Bisection Hybrid (Newt-Safe)”. Link: https://youtu.be/FD3BPTMGJds.

For the partial derivatives, I can take advantage of the fact that this function and tfp_math.betainc are inverses of each other (the same strategy used for computing the gradients of tfp_math.igammainv). By the way, I worked on some improvements for evaluating the partial derivatives of tfp_math.betainc: see the PR https://github.com/tensorflow/probability/pull/1580.

Can I work on this task?

All the best,

Leandro Campos

leandrolcampos avatar Jun 26 '22 19:06 leandrolcampos

Hi, @srvasude!

I hope this message finds you well.

I already have an implementation of tfp_math.betaincinv. In my opinion, its numerical accuracy and stability are good enough. Because it depends on the PR #1580, which hasn't been merged yet, I don't know how to proceed to create a new PR with this implementation. Should I wait for the PR #1580 to be merged? Should I create a new PR based on a branch created from the branch of the PR #1580? Another alternative?

All the best,

leandrolcampos avatar Jul 24 '22 19:07 leandrolcampos

I'd suggest waiting until #1580 gets merged. I think it's close.

Brian Patton | Software Engineer | @.***

On Sun, Jul 24, 2022 at 3:20 PM Leandro Campos @.***> wrote:

Hi, @srvasude https://github.com/srvasude!

I hope this message finds you well.

I already have an implementation of tfp_math.betaincinv. In my opinion, its numerical accuracy and stability are good enough. Because it depends on the PR #1580 https://github.com/tensorflow/probability/pull/1580, which hasn't been merged yet, I don't know how to proceed to create a new PR with this implementation. Should I wait for the PR #1580 https://github.com/tensorflow/probability/pull/1580 to be merged? Should I create a new PR based on a branch created from the branch of the PR #1580 https://github.com/tensorflow/probability/pull/1580? Another alternative?

All the best,

— Reply to this email directly, view it on GitHub https://github.com/tensorflow/probability/issues/1581#issuecomment-1193378334, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJFSI4HSDCR5QTQGGPXCV3VVWJPDANCNFSM5Z4NY7UQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

brianwa84 avatar Jul 28 '22 21:07 brianwa84

Sorry for the delay, the PR has been merged.

srvasude avatar Aug 01 '22 21:08 srvasude

Thanks for the answers. I created a PR with my implementation.

leandrolcampos avatar Aug 04 '22 20:08 leandrolcampos

This issue was addressed in #1597.

leandrolcampos avatar Aug 25 '22 10:08 leandrolcampos