bug in gsl_ran_chisq_pdf

Martin Jansche jansche@ling.ohio-state.edu
Tue Apr 8 17:38:00 GMT 2003


On Tue, 8 Apr 2003 keith.briggs@bt.com wrote:

> In gsl-1.3, gsl_ran_chisq_pdf(0.0,nu) is wrong.
>
> It returns 0.0 whatever nu is.

That seems to be the default behavior, absent the indication of a
domain error.  The Gamma pdf on x requires x > 0, so it does make some
sense to return 0 for any x outside the defined domain.

You seem to be suggesting that the limit for x->0 from above be
returned instead.

> It should return Inf for nu=1.
> It should return 0.5 for nu=2.
> It should return 0.0 for nu>2.

The parameter nu is declared double, so your suggestion is not
exhaustive.  You probably meant to say

  raise an error for nu <= 0
  return Inf for 0 < nu < 2
  return 0.5 for nu == 2
  return 0.0 for nu > 2

Anyway, I haven't seen an explicit statement about the desired
behavior of the _pdf functions when the main argument is outside the
domain of definition.  Personally, I find the currently implemented
behavior reasonable: the univariate PDFs in GSL are defined on
single intervals, and the _pdf functions return 0 for values outside
the interval (the _cdf functions would have to return 0 below the
defined interval and 1 above).

- martin



More information about the Gsl-discuss mailing list