[R] comment in src/nmath/dgamma.c

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jun 26 09:04:55 CEST 2005


On Sat, 25 Jun 2005, Faheem Mitha wrote:

>
> Hi,
>
> In src/nmath/dgamma.c the comment at the top says
>
>  * DESCRIPTION
>  *
>  *   Computes the density of the gamma distribution,
>  *
>  *                   1/s (x/s)^{a-1} exp(-x/s)
>  *        p(x;a,s) = -----------------------
>  *                            (a-1)!
>  *
>  *   where `s' is the scale (= 1/lambda in other parametrizations)
>  *     and `a' is the shape parameter ( = alpha in other contexts).
>
> Maybe I'm missing something, but shouldn't the denominator be Gamma(a)
> (since a is not necessarily an integer)?

\Gamma(x+1) _is_ the definition of x! for x not an integer.  It has not 
defined x! and you have not defined Gamma(x) and I don't see one is 
necessarily preferable to the other.  The user-level documentation uses 
Gamma(a) but it can refer to the definition in ?gamma.


Please see the posting guide and consider which list you use: comments in 
the R source code are not really end-user questions and R-devel is the 
appropriate place to discuss the R sources.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list