oct issueshttps://gitlab.common-lisp.net/oct/oct/-/issues2020-11-24T22:11:43Zhttps://gitlab.common-lisp.net/oct/oct/-/issues/12Implement inverse-incomplete-gamma2020-11-24T22:11:43ZSymbolicsImplement inverse-incomplete-gammainverse-incomplete-gamma is used for computing quantiles of the gamma distribution and is a fundamental computation in a statistical setting. This issue proposes to develop this, and possibly other missing gamma related functions, to 'ro...inverse-incomplete-gamma is used for computing quantiles of the gamma distribution and is a fundamental computation in a statistical setting. This issue proposes to develop this, and possibly other missing gamma related functions, to 'round out' the gamma family.https://gitlab.common-lisp.net/oct/oct/-/issues/4Implement incomplete-beta family of functions2020-11-28T03:09:14ZSymbolicsImplement incomplete-beta family of functionsThe beta function is easily implemented in terms of gamma:
```
(defun beta (p q)
"Compute beta with gamma function"
(/ (* (NET.COMMON-LISP.OCT::gamma p) (NET.COMMON-LISP.OCT::gamma q))
(NET.COMMON-LISP.OCT::gamma (+ p q))))
```...The beta function is easily implemented in terms of gamma:
```
(defun beta (p q)
"Compute beta with gamma function"
(/ (* (NET.COMMON-LISP.OCT::gamma p) (NET.COMMON-LISP.OCT::gamma q))
(NET.COMMON-LISP.OCT::gamma (+ p q))))
```
More useful however are the integral functions of beta. There are two BSD/MIT licensed version based on gamma, [incb.c](https://github.com/codeplea/incbeta) and [an implementation in the CRISP genomic project](https://github.com/vibansal/crisp/blob/e6f296df58171d86e0bd85ee645656b1bcacb595/FET/kfunc.c#L118). Both use Lentz's algorithm to evaluate the continued fraction, which OCT also uses for gamma.
It seems it should be possible to add the incomplete beta function in a similar manner. This isn't a type of programming I do often, and it's not entirely clear how to use the OCT lentz function to port the code from one of these implementations. Perhaps if someone could sketch out how a a 'proper' (from an OCT perspective) implementation of upper and lower incomplete beta might work I can run with it.
To use in a statistical context, we need:
- incomplete-beta-lower
- incomplete-beta-upper
- beta
- inverse-incomplete-beta (to compute quantiles)