views:

176

answers:

3

I need to use beta distribution and inverse beta distribution in my project.

There is quite good but complicated implementation in GSL, but I don't want to use such a big library only to get one function.

I would like to either, implement it on my own or link some simple library. Do you know any sources that could help me? I'm looking for any books/articles about numerical approximation of beta CDF and its inverse, libraries where it could be implemented. Any other suggestions would be also appreciated.
Any programming language, but C++/C# preffered.

A: 

Fifteen seconds of googling lead to this page at fsu.edu with code for the CDF of the non-central Beta distribution in several languages.

That said, I'd re-consider your stance on the GNU GSL as that is also a pretty high-quality and well-vetted library.

Dirk Eddelbuettel
A: 

Here is a managed C++ library that has the beta CDF and its inverse: DCDFLIB. It's a port of the popular Fortran/C library of the same name. If you have questions about how to use the code, I'm familiar with it and can help.

You could take DCDFLIB and delete what you don't use, but it's still going to be big. Implementing the beta CDF and its inverse accurately for a wide range of parameters is complicated.

John D. Cook
+1  A: 

Well, I found some other libraries/implementations:

  1. Boost library for C++
  2. Some code in C# at google code
  3. And simple but not exactly perfect implementation of inverse beta cdf
Gacek