[Rd] Bug in 'pchisq' for x=0.0 (PR#9485)
maechler at stat.math.ethz.ch
maechler at stat.math.ethz.ch
Wed Jan 31 17:38:48 CET 2007
>>>>> "MN" == Michael Nothnagel <nothnagel at medinfo.uni-kiel.de>
>>>>> on Wed, 31 Jan 2007 15:16:02 +0100 (CET) writes:
MN> The function 'pchisq' from the 'stats' library gives a wrong result if the
MN> argument equals exactly zero:
MN> # Upper tail of central 1-df chi^2 distribution
>> pchisq(1 , 1, ncp=0, lower.tail = F, log.p = FALSE)
MN> [1] 0.3173105
>> pchisq(0.5 , 1, ncp=0, lower.tail = F, log.p = FALSE)
MN> [1] 0.4795001
>> pchisq(0.01 , 1, ncp=0, lower.tail = F, log.p = FALSE)
MN> [1] 0.9203443
>> pchisq(0.0001 , 1, ncp=0, lower.tail = F, log.p = FALSE)
MN> [1] 0.9920213
>> pchisq(0.00000001, 1, ncp=0, lower.tail = F, log.p = FALSE)
MN> [1] 0.9999202
>> pchisq(0.00 , 1, ncp=0, lower.tail = F, log.p = FALSE)
MN> [1] 0 ## Should be 1.0
MN> The error occurred with R version 2.4.0 (windows) and version 2.3.1 (linux).
Yes, but both of these R versions are outdated.
The current version is 2.4.1
and there, the result *is* 1.
Regards,
Martin Maechler, ETH Zurich
More information about the R-devel
mailing list