Full_Name: Gerard Torrent
Version: R version 2.8.0 (2008-10-20)
OS: Linux 2.6.27.5-41.fc9.x86_64 #1 SMP
Submission from: (NULL) (85.52.227.233)


In some cases qt complains about NaNs and don't gives the correct result:

> qt(0.1,, 0.1)
[1] NaN
Warning message:
In qt(p, df, lower.tail, log.p) : NaNs produced

But the result can be found:
> pt(-1.60443e+06, 0.1)
[1] 0.09999997

If I replace the current method by bisection method in file file src/nmath/qt.c
the result is computed fine.

int cont=0;
do {
        cont++;
        nx = lx + (ux - lx)/2.0;
        if ((pp = pt(nx, ndf, TRUE, FALSE)) > p) {
                ux = nx; pu = pp;
        } else {
                lx = nx; pl = pp;
        }
}
while ((ux - lx) / fabs(nx) > accu && cont < 100);


______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to