From maechler at stat.math.ethz.ch  Fri Jul 16 18:17:35 2004
From: maechler at stat.math.ethz.ch (maechler@stat.math.ethz.ch)
Date: Fri Jul 16 18:17:37 2004
Subject: [Rd] inconsistency in pchisq (PR#7099)
Message-ID: <20040716161735.5B8AF108BC@slim.kubism.ku.dk>

>>>>> "Richard" == Richard Mott <Richard.Mott@well.ox.ac.uk>
>>>>>     on Fri, 16 Jul 2004 16:30:05 +0200 (CEST) writes:

    Richard> Full_Name: Richard Mott Version: 1.9.0 OS: Windows
    Richard> XP Submission from: (NULL) (81.178.233.208)


    Richard> Shouldn't these give the same answer?

well, no,..
though I agree it should be mentioned in the documentation

    > pchisq(67.60644,df=1,lower.tail=F,ncp=0)
    [1] 3.219647e-15
    > pchisq(67.60644,df=1,lower.tail=F)
    [1] 1.996145e-16

The first call uses the internal code
for non-central chisq, the 2nd one using the central chisq.
In extreme cases (like the above), these differ more than just
neglibly.  
But we want to have both available, partly for experimental reasons

BTW 1: There are still concrete plans (by me) to use better (and much
     larger) code for improved incomplete beta and gamma
     functions which are really at the base of many of these
     p*() functions [and often consequently the q*() ones] in R.

BTW 2: the same (difference between "no ncp" and "ncp=0")
       applies to   pt(*, ncp).

--
Martin Maechler


[Rd] inconsistency in pchisq (PR#7099)
maechler@stat.math.ethz.ch