Open TeMPOraL opened 6 years ago
That is not exactly surprising as I expect SciPy and R versions has had more eyes on it. That said there is no reason why we can fix things when we find things....
FWIW, I traced SciPy implementation of the beta-quantile function to the Cephes library. In particular, I managed to get the code from this fork working (and giving results in agreement with SciPy) in C and through CFFI, so that would be the implementation to compare to.
The function in question is incbi.
I've encountered the following issue:
aborts after second iteration of
#'newton-raphson
through an assertion in#'regularized-incomplete-beta
(see trace below).However, the same parameters tested on Python (SciPy), R and Wolfram|Alpha Open Code all agree the result should be ~ 1.856702e-34.
I've looked into the code of
#'quantile
, comaring it with SciPy (btdtri()
) and R (qbeta()
); it seems to me that the Python/R versions are implemented to handle some corner cases the Lisp code doesn't.Related,
(clml.statistics:quantile (clml.statistics:beta-distribution 0.1 0.9) 0.23)
gyrates for a while, and eventually breaks on division by zero (Wolfram suggests the result should be 4.886*10^-7).Trace: