Closed lorinder closed 1 year ago
The previous implementation was simply 1 - cumulative, with the obvious accuracy problems when the the cumulative value is close to 1. The new implementation uses the symmetry of the incomplete Beta function to achieve more accurate numbers.
Example of the problem:
ghci> p = 16785/32768 :: Double ghci> complCumulative (binomial 283 p) 232 0.0
The correct answer in this case is 8.565988198569857e-28.
8.565988198569857e-28
Thank you! I'm glad that you take numerical bugs seriously
The previous implementation was simply 1 - cumulative, with the obvious accuracy problems when the the cumulative value is close to 1. The new implementation uses the symmetry of the incomplete Beta function to achieve more accurate numbers.
Example of the problem:
The correct answer in this case is
8.565988198569857e-28
.