Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I need to calculate $\text{B}_x(a,b)$ on the cheap, without too many coefficients and loops. For the complete $\text{B}(a,b)$, I can use $\Gamma(a)\Gamma(b)/\Gamma(a+b)$, and Stirling's approximation for $\Gamma(.)$. Is there a way to calculate the incomplete beta function using Stirling's approximation?

share|improve this question
    
To give a genuinely useful answer, you need to specify the specific ranges of $a$, $b$, and $x$ you are interested in. Methods that, for instance, work nicely for "human-sized" $a$ and $b$ (e.g. Eric's suggestion) fail spectacularly when either of $a$ or $b$ is large. If $x$ is outside $[0,1]$, special methods are needed, too... –  J. M. Jul 27 '11 at 2:11
    
FWIW: due to the properties of ${}_2 F_1$, incomplete beta satisfies three term recurrence relations, which might be helpful if you'll be fixing some parameters. If for instance your goal is to numerically compute the CDF for the $\mathbf F$ or Student $t$ distributions, there are specially adapted methods for that as well. –  J. M. Jul 27 '11 at 2:14
add comment

2 Answers

I believe that one of the fastest ways to compute $\text{B}(a,b,x)$ is to simply use numerical integration. The integrand is very nice, and the interval is small. In fact, I think given a fixed amount of time, numerical integration will yield higher accuracy for $\text{B}(a,b)$ then Stirlings formula.

There are many times where we have explicit formulas for certain integrals in terms of the gamma function and other well known functions, but to evaluate those integrals the basic numerical integration is used instead of evaluating the known exact expression.

share|improve this answer
add comment

You can express ${\rm B}(x;a,b)$ in terms of the hypergeometric function
$$ F(a,b;c;z) = 1 + \frac{{ab}}{c}z + \frac{{a(a + 1)b(b + 1)}}{{c(c + 1)2!}}z^2 + \cdots , $$ as $$ {\rm B}(x;a,b) = \frac{{x^a }}{a}F(a,1 - b;a + 1;x) $$ or $$ {\rm B}(x;a,b) = \frac{{x^a (1 - x)^b }}{a}F(a + b,1;a + 1;x). $$ For this and more, see here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.