3
$\begingroup$

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?

$\endgroup$
2
  • 2
    $\begingroup$ 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... $\endgroup$ – J. M. isn't a mathematician Jul 27 '11 at 2:11
  • 1
    $\begingroup$ 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. $\endgroup$ – J. M. isn't a mathematician Jul 27 '11 at 2:14
5
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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