public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Problems with gsl_cdf_gamma_Pinv(0.01,a,b)
@ 2007-10-23  5:50 Benjamin Redelings
  2007-10-23 22:11 ` Brian Gough
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Redelings @ 2007-10-23  5:50 UTC (permalink / raw)
  To: gsl-discuss

Hi,

I have been using GSL 1.10 on a 64-bit linux system (Debian/AMD64), and 
I've been trying to figure out how to handle problems like the following:

    // works fine
    gsl_cdf_gamma_Pinv(0.01, 11.888, 1.0);

    // fails to converge
    gsl_cdf_gamma_Pinv(0.01,11.887411491530846,1.0);

Since version 1.10, this failure is a hard failure - e.g. it returns 
GSL_NAN or it terminates. 

My explorations indicate that the range on 'a' in this function is not 
very large, in the grand scheme of things.  It seems like it can be 
expected to work if 'a' is in [0.25, 10] and also for some values outside.

Q1: I'm very much interested in advice on how to handle this kind of 
situation.  Should I expect this to work in GSL, or is there some reason 
why GSL does not want this to work (e.g. speed issues)?  Should I write 
some code myself to revert to a gaussian when a > 10?

Q2: I notice that the R code for this function is more intricate and 
seems to handle values of alpha that are very high (e.g. 500) and very 
low (0.01).  At least, qgamma(0.0001,500,1) and qgamma(0.0001,0.01,1) 
give me answers inside the R program.

The R algorithm seems to use the Chi^2 distribution (which is, I 
suppose, like the Normal distribution, effectively scale-independent).  
Is there any interest in expanding gsl_cdf_gamma_Pinv( ) to handle 
similar ranges to the code in R?

https://svn.r-project.org/R/trunk/src/nmath/qgamma.c

Thanks!

-BenRI

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problems with gsl_cdf_gamma_Pinv(0.01,a,b)
  2007-10-23  5:50 Problems with gsl_cdf_gamma_Pinv(0.01,a,b) Benjamin Redelings
@ 2007-10-23 22:11 ` Brian Gough
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gough @ 2007-10-23 22:11 UTC (permalink / raw)
  To: Benjamin Redelings; +Cc: gsl-discuss

At Mon, 22 Oct 2007 16:16:22 -0400,
Benjamin Redelings wrote:
> Q1: I'm very much interested in advice on how to handle this kind of 
> situation.  Should I expect this to work in GSL, or is there some reason 
> why GSL does not want this to work (e.g. speed issues)?  Should I write 
> some code myself to revert to a gaussian when a > 10?

Hello,

Thanks for the bug report, I have added a test case for that value.
You should expect this sort of thing to work in GSL -- definitely.

I added the hard failures in 1.10 as the problem was reported when I
was making the release and I didn't have time to fix it fully.  Some
of the other inverse functions were also affected so I thought it best
to report an error.

I would welcome any patches or other suggestions on the best way to
calculate this.  High precision test values to add to test.c are also
useful.

-- 
Brian Gough

GNU Scientific Library -
http://www.gnu.org/software/gsl/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-23 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-23  5:50 Problems with gsl_cdf_gamma_Pinv(0.01,a,b) Benjamin Redelings
2007-10-23 22:11 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).