[Rd] qt() returns Inf with certain negative ncp values

Stephen Berman @tephen@berm@n @end|ng |rom gmx@net
Wed Jun 15 00:55:49 CEST 2022


On Tue, 14 Jun 2022 18:00:24 +0200 Martin Maechler <maechler using stat.math.ethz.ch> wrote:

>>>>>> GILLIBERT, Andre
>>>>>>     on Tue, 14 Jun 2022 13:39:41 +0000 writes:
>
>     > Hello,
>     >> I asked about the following observations on r-help and it
>     >> was suggested that they may indicate an algorithmic
>     >> problem with qt(), so I thought I should report them
>     >> here.
>
> Which is fine.
> Usually you should *CAREFULLY* read the corresponding reference
> documentation before posting.

I actually have read the documentation before, though admittedly I
didn't reread it carefully before posting, but I vaguely remembered the
reservations about the tail accuracy of large values.  The main reason I
posted was my surprise at getting seemingly good values, then suddenly
Inf, then again seemingly good values.  I actually ran into this issue
when I was graphing various effect sizes with t-distributions and with a
large effect suddenly got an error and no graph, but then with an even
larger effect got a graph again.

[...]
> Still, this lack of a better algorithm had bothered me (as R
> Core member) in the past quite a bit, and I had implemented other
> approximations for cases where the current algorithm is
> deficient... but I had not been entirely satisfied, nor had I
> finished exploring or finding solutions in all relevant cases.
>
> In the mean time I had created CRAN package 'DPQ' (Density,
> Probability, Quantile computations) which also contains
> quite a few functions related to better/alternative computations
> of pt(*, ncp=*)  which I call pnt(), not the least because R's
> implementation of the algorithm is in   <Rsrc>/src/nmath/pnt.c
> and the C function is called pnt().
>
> Till now, I have not found a student or a collaborator to
> finally get this project further  {{hint, hint!}}.
>
> In DPQ, (download the *source* package if you are interested),
> there's a help page listing the current approaches I have
>
>   https://search.r-project.org/CRAN/refmans/DPQ/html/pnt.html
> or
>   https://rdrr.io/cran/DPQ/man/pnt.html
>
> Additionally, in the source (man/pnt.Rd) there are comments about a not yet
> implemented one, and there are even two R scripts exhibiting
> bogous (and already fixed) behavior of the non-central t CDF:
>
>  https://rdrr.io/rforge/DPQ/src/tests/t-nonc-tst.R   and
>  https://rdrr.io/rforge/DPQ/src/tests/pnt-prec.R
>
> Indeed, this situation *can* be improved, but it needs dedicated work
> of people somewhat knowledgable in applied math etc.
>
> Would you (readers ..) be interested in helping?

I'm afraid I don't have enough knowledge or time to be useful for such a
project.  But what you describe sounds interesting and I'll try to find
time to look at it.

Thanks for your reply, I really appreciate it.

Steve Berman



More information about the R-devel mailing list