MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ContinuousDistributions bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38451] Re: ContinuousDistributions bug?
  • From: Nigel King <king at dircon.co.uk>
  • Date: Mon, 16 Dec 2002 02:20:41 -0500 (EST)
  • References: <at4aqi$eb6$1@smc.vnet.net> <atca6i$3kd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Reformatted
Thanks Tom for your input, responses below; 
>> There seems to be a bug here due to the fact that ContinuousDistributions.m 
>> (4.0.0) does not check that q is numeric. 
>>  
>> Quantile[NoncentralChiSquareDistribution[2, 10], q] 
>> Produces a load of errors and some incorrect results when used in LogPlot. 
>>  
>> LogPlot[Quantile[NoncentralChiSquareDistribution[2, 10], q], {q, .1, .9}] 
>>  
>> This is of course a pain. What is the best way to correct this? Is it to 
>> copy the particular function from ContinuousDistribution.m and re-include it 
>> in a little add on or is there an updated version.
> I cannot reproduce your difficulty in 4.2. LogPlot there has attribute 
> HoldFirst,  
Yes so does 4.0 
Attributes[LogPlot]
{HoldFirst} 

I do not understand why this is insufficient to hold off the evaluation until q gets a value. I suspect that it is something to do with the complexity of LogPlot's calls to scaledplot etc.

> so no attempt is made to evaluate Quantile[...] before a numeric 
> value is substituted for q. If this is not true in version 4.0, then you
> might try 
>  
> LogPlot[Unevaluated[Quantile[NoncentralChiSquareDistribution[2, 10], q]], 
> {q, .1, .9}] 
I was unfamiliar with Unevaluated. One would expect it to do the trick but it 
doesn't stop the Nintegrate ::nlim error 
>  
> Tom Burton 
>  
> PS I am unfamiliar with this distribution and would not notice "some 
> incorrect results". TB 

I am reasonably certain the the incorrect results are 
caused by premature evaluation since I have rebuilt the function outside 
ContinuousDistributions and got what I believe are correct results. 

Would I be right in presuming that 4.2 has this problem fixed in which 
case it would be nice to be able to get hold of the 4.2 version of 
ContinuousDistributions.m

My other possibility is to call my version which then rewrites the offending piece. In order to do that I think that I will need to  Set the context to 
Statistics`ContinuousDistributions`Private` Clear[Quantile[
NoncentralChiSquareDistribution]] Reprogram with the q_?NumericQ in 
place.

I have actually corrected my copy of ContinuousDistributions.m by changing the line

NoncentralChiSquareDistribution/:
  Quantile[NoncentralChiSquareDistribution[n_, lambda_], q_, opts___?OptionQ] :=

to

NoncentralChiSquareDistribution/:
  Quantile[NoncentralChiSquareDistribution[n_, lambda_], q_?NumericQ, opts___?OptionQ] :=

This seems to be effective.
-- 
Nigel


  • Prev by Date: Re: saving a notebook into LaTeX
  • Next by Date: Re: Numeric Integration of Tabulated Integrand Function: Part I
  • Previous by thread: Re: ContinuousDistributions bug?
  • Next by thread: Re: ContinuousDistributions bug?