SpecialFunctions.jl icon indicating copy to clipboard operation
SpecialFunctions.jl copied to clipboard

WIP: Partial derivatives of betainc

Open bdeonovic opened this issue 4 years ago • 3 comments

Chain rules for partial derivatives of incomplete beta. Code is by @arzwa and taken from

https://github.com/arzwa/IncBetaDer/blob/main/src/beta_inc_grad.jl

Related to effort to provide julia implementations of pdf/cdf like functions (https://github.com/JuliaStats/StatsFuns.jl/pull/113) and associated problems (https://github.com/JuliaStats/Distributions.jl/issues/1334)

bdeonovic avatar Jul 28 '21 19:07 bdeonovic

The algorithm used to compute the partial derivatives doesn't seem very accurate (I had to go down to atol=0.1 in the tests). I'll see if any other languages use a different algorithm

bdeonovic avatar Jul 29 '21 00:07 bdeonovic

After reviewing the algorithms used for incomplete beta it is obvious that different approximations perform better in different domains of input variables. Unfortunately I have only found derivations of partial derivatives for a continued fraction approximation of incomplete beta (however not the one we are using for the incomplete beta).

We can put these derivatives in place while acknowledging that they are not be accurate for all ranges of inputs, or we can hold off until someone derives partial derivatives for more of the approximation methods (if that is even possible).

Thoughts?

bdeonovic avatar Aug 02 '21 15:08 bdeonovic

For my future self: https://duetosymmetry.com/notes/take-derivative-continued-fraction/

bdeonovic avatar Dec 02 '21 21:12 bdeonovic