>> Home >> Resources & support >> FAQs >> Calculating the beta function

How do I calculate values of the beta function?

Title   Calculating the beta function
Author Nicholas J. Cox, Durham University, UK

The beta function can be defined in terms of the gamma function and thus, calculated using the Stata functions exp() and lngamma(). On the latter, see the section "Mathematical functions" of the [D] Functions. Given arguments a and b, the beta function

        Β(a,b) = Γ(a) Γ(b) / Γ(a + b)

can be calculated from

        exp(lngamma(a) + lngamma(b) - lngamma(a + b))  

In this expression, each argument may be a number, a variable, or, more generally, itself an expression.





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ YouTube
© Copyright 1996–2016 StataCorp LP   •   Terms of use   •   Privacy   •   Contact us