[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #43721] binocdf - cumulative distribution func
From: |
Falk Tannhäuser |
Subject: |
[Octave-bug-tracker] [bug #43721] binocdf - cumulative distribution functions lack "upper" argument |
Date: |
Sun, 30 Nov 2014 13:18:17 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 |
Follow-up Comment #4, bug #43721 (project octave):
Well, that's a quick&dirty fix for someone needing just approximate Matlab
compatibility; however it doesn't solve the problem of accuracy - results
below 1e-16 will be wrongly returned as 0, which for many practical purposes
is not acceptable.
I attach another version of binocdf.m where in case of "upper",
betainc (p, x + 1, n - x)
is called instead of
betainc (1 - p, n - x, x + 1)
which avoids this loss of accuracy.
For instance,
1 - binocdf(0:10, 10, 1e-5)
yields
[ 9.9996e-05 4.4998e-09 1.2002e-13 0.0000e+00 0.0000e+00 0.0000e+00
0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 0.0000e+00 ]
while with my version
binocdf(0:10, 10, 1e-5, "upper")
yields
[ 9.9996e-05 4.4998e-09 1.1999e-13 2.0999e-18 2.5199e-23 2.0999e-28
1.2000e-33 4.4999e-39 9.9999e-45 1.0000e-50 0.0000e+00 ]
I also added a test case
%!assert (binocdf(99, 100, 0.1, "upper"), 1e-100, 1e-112)
Of course, binocdf() is just one among many other CDF and analogous fixes have
to be applied for all the other xxxcdf functions listed on
https://www.gnu.org/software/octave/doc/interpreter/Distributions.html#Distributions
- that's a considerable amount of work!
(file #32575)
_______________________________________________________
Additional Item Attachment:
File name: binocdf.m Size:3 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?43721>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/