Hi,
I've implemented the Beta distribution and also provided an implementation of the incomplete Beta function (which is the CDF for the Beta distribution).
I've tested the incomplete Beta function quite a bit (as shown), and think that it is now robust. However, I probably didn't make the most efficient implementation. An alternative would be the collection of algorithms in DCDFLIB (http://people.scs.fsu.edu/~burkardt/f_src/dcdflib/dcdflib.html), but it is quite involved -- if this implementation is sufficient, so much the better.
Eric
Logged In: YES
user_id=816411
Originator: YES
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
I'm attaching a version of the incomplete beta function that is significantly faster (about 10 faster for some values) than the original version I posted.
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
Attaching a new version. Fixes an edge case that can make the routine hang. Also introduces a short-cut in case of integer value for b.
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
File Added: beta.zip
Logged In: YES
user_id=816411
Originator: YES
File Added: beta.zip
Improved beta distribution
Logged In: YES
user_id=816411
Originator: YES
This is a better implementation for the beta distribution. First, I extended the useful range for the pdf. Second, I implemented a much faster algorithm for the incomplete beta function, using a continued fraction from Abramowitz & Stegun. (I used the GNU Scientific Library for inspiration, but ended up using a different continued fraction expansion than they used, so there's no GPL concern here. The speeds are comparable.)
File Added: beta.zip
Logged In: YES
user_id=400048
Originator: NO
Incorporated this. One thing to think about:
pdf-beta a b 0.0 or 1.0 are edge cases that should give either 0 or infinity (depending on a and b).
Right now, they give 0 only.