s-news
[Top] [All Lists]

Re: gamma function

To: "Spencer Graves" <spencer.graves@pdf.com>, "Christoph Scherber" <Christoph.Scherber@uni-jena.de>
Subject: Re: gamma function
From: "David Smith" <dsmith@insightful.com>
Date: Fri, 30 Jan 2004 10:07:22 -0800
Cc: "s-news" <s-news@wubios.wustl.edu>
Thread-index: AcPnVz1qdAIjt3ZpQa6VGesYanNeUQABFdOw
Thread-topic: [S] gamma function
> Unless Insightful wants to tell you exactly how they 
> compute the gamma function, you may be out of luck.

Insightful is quite happy to do so. :)  The details are right there in
help(gamma):

For shape less than 10^8 pgamma(q,shape) is computed using formulae 6.5.31
and 6.5.32 of Abramowitz and Stegun (1970). For these values of shape dgamma
is computed based on the lgamma function. For larger values of shape pgamma
and dgamma use a normal approximation, adjusted for skewness only. See
formulae 26.2.48 and 26.1.32 of Abramowitz and Stegun. There may be slight
discontinuities in higher derivatives at shape==10^8. 

The transition between algorithms (the source of the aforementioned
discontinuity) is necessary to get the best accuracy possible for both large
and small values of q and shape.

# David Smith

-- 
David M Smith <dsmith@insightful.com>
Product Manager, Insightful Corp, Seattle WA
Tel: +1 (206) 802 2360
Fax: +1 (206) 283 6310

New Insightful Miner 3! Discover how Pfizer, Bank of America and others are
using Insightful Miner -- a highly scalable data analysis workbench. Learn
more at http://www.insightful.com/products/iminer

> -----Original Message-----
> From: Spencer Graves [mailto:spencer.graves@pdf.com]
> Sent: Friday, January 30, 2004 4:37 AM
> To: Christoph Scherber
> Cc: s-news
> Subject: Re: [S] gamma function
> 
> 
> Hi, Christoph: 
> 
>       Unless Insightful wants to tell you exactly how they 
> compute the 
> gamma function, you may be out of luck.  However, R is open 
> source, and 
> from "www.r-project.org", you can download the source and read it.  I 
> don't know Delphi, but if it can link to compiled C or 
> Fortran, then you 
> can link straight to the object code without ever having to read the 
> source. 
> 
>       hope this helps. 
>       Spencer Graves
> 
> Christoph Scherber wrote:
> 
> >Hi!
> >
> >Can anyone tell me how S-Plus calculates the gamma function? 
> I would like to
> >write a gamma function for Delphi and would need the exact 
> way in which this
> >function is calculated.
> >
> >Specifically, I need to calculate the factorial of 
> non-integer values (such as
> >0.5; 0.3 etc).
> >
> >Thanks very much for your help!
> >Chris
> >
> >-----------------------------------------------------
> >This mail was sent through http://webmail.uni-jena.de
> >--------------------------------------------------------------------
> >This message was distributed by s-news@lists.biostat.wustl.edu.  To
> >unsubscribe send e-mail to 
> s-news-request@lists.biostat.wustl.edu with
> >the BODY of the message:  unsubscribe s-news
> >  
> >
> 
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
> 

<Prev in Thread] Current Thread [Next in Thread>