public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: bug in gsl_ran_chisq_pdf
@ 2003-04-10  4:58 Rodney Sparapani
  0 siblings, 0 replies; 4+ messages in thread
From: Rodney Sparapani @ 2003-04-10  4:58 UTC (permalink / raw)
  To: gsl-discuss


>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

Fascinating discussion.  However, the foundation of the Chi-square distribution 
should follow from the sum of squared, independent standard Normals rather than 
a special case of the Gamma distribution.  If that's the case, then the 
Chi-square pdf is defined at 0; for example, see Kendall's Advanced Theory of 
Statistics, Volume I:  Distribution Theory.  By the way, I think the previous 
correspondents are neglecting the term 1/sqrt(pi).  

Rodney Sparapani              Medical College of Wisconsin
Sr. Biostatistician           Patient Care & Outcomes Research
rsparapa@mcw.edu              http://www.mcw.edu/pcor
Was 'Name That Tune' rigged?  WWLD -- What Would Lombardi Do

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

* Re: bug in gsl_ran_chisq_pdf
  2003-04-08 17:38 ` Martin Jansche
@ 2003-04-10 12:47   ` Brian Gough
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Gough @ 2003-04-10 12:47 UTC (permalink / raw)
  To: gsl-discuss

Martin Jansche writes:
 > 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).

I have in mind,
 
return 0 outside valid range (as currently)
return NaN for invalid parameters (not actually implemented)

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

* Re: bug in gsl_ran_chisq_pdf
  2003-04-08 14:18 keith.briggs
@ 2003-04-08 17:38 ` Martin Jansche
  2003-04-10 12:47   ` Brian Gough
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Jansche @ 2003-04-08 17:38 UTC (permalink / raw)
  To: gsl-discuss

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

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

* bug in gsl_ran_chisq_pdf
@ 2003-04-08 14:18 keith.briggs
  2003-04-08 17:38 ` Martin Jansche
  0 siblings, 1 reply; 4+ messages in thread
From: keith.briggs @ 2003-04-08 14:18 UTC (permalink / raw)
  To: gsl-discuss

In gsl-1.3, gsl_ran_chisq_pdf(0.0,nu) is wrong.

It returns 0.0 whatever nu is.

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

Keith

	Dr. Keith M. Briggs
	Senior Mathematician, Complexity Research, BTexact.
	phone: +44(0)1473  work: 641 911 home: 610 517  fax: 642 161
        profile:  http://www.btexact.com/ideas/profiles?doc=42493
        web:  (work)     http://more.btexact.com/people/briggsk2/ 
        web:  (private) http://members.lycos.co.uk/keithmbriggs/
	mail: Keith Briggs, Polaris 134, Adastral Park, Martlesham, Suffolk
IP5 3RE, UK

	BTexact is a trademark of British Telecommunications plc
	Registered office: 81 Newgate Street London EC1A 7AJ
	Registered in England no. 1800000

	This electronic message contains information from British
Telecommunications plc which may be privileged or confidential. The
information is intended to be for the use of the individual(s) or entity
named above. If you are not the intended recipient be aware that any
disclosure, copying, distribution or use of the contents of this information
is prohibited. If you have received this electronic message in error, please
notify us by telephone or email (to the numbers or address above)
immediately.


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

end of thread, other threads:[~2003-04-10 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-10  4:58 bug in gsl_ran_chisq_pdf Rodney Sparapani
  -- strict thread matches above, loose matches on Subject: below --
2003-04-08 14:18 keith.briggs
2003-04-08 17:38 ` Martin Jansche
2003-04-10 12:47   ` 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).