Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: gamma

From   "JVerkuilen (Gmail)" <>
Subject   Re: st: gamma
Date   Thu, 11 Oct 2012 10:17:29 -0400

On Thu, Oct 11, 2012 at 8:31 AM, Nick Cox <> wrote:
> There is no function -gamma()-, largely I suspect because its values
> become very big.

The gamma function will overflow rapidly. That's why almost all
computation involving the gamma function is done on log scale, which
make sense because the gamma function is essentially a factorial, so
using log makes it behave like an additive rather than a
multiplicative function.

I don't know about Stata's lngamma function specifically, but in SAS
it will overflow for arguments 10^7 or 10^-7 or so. It is thus
important to program carefully to avoid very small or very large
arguments appearing suddenly. I doubt that Stata's function is much
different because both probably use the same basic numerics libraries
and double precision arithmetic.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index