[Rd] Re: [R-SIG-Mac] Bug running pbinom() in R-GUI?

IandJMSmith at aol.com IandJMSmith at aol.com
Wed Feb 23 12:25:01 CET 2005

Given TOMS708 has been incorporated into R and that the original pbeta_raw routine had more problems than just large shape parameters, why wasn’t it rewritten as

double pbeta_raw(double x, double pin, double qin, int lower_tail)
    /* Use TOMS 708 */
    double x1 = 1 - x, w, wc;
    int ierr;
    bratio(pin, qin, x, x1, &w, &wc, &ierr);
    return lower_tail ? w : wc;

Incidentally, in pbeta, I thought the point of the log_p parameter was to return the logged value particularly for cases where the non-logged version of pbeta_raw returns 0. It’s not difficult to modify bratio to do this, provided that’s allowed.

I think the other remarks made by Morten Welinder in PR#7153 still stand, namely several functions which called pbeta and have kludge code to compensate for its previous weaknesses could be significantly improved  by removal of the kludges.

Ian Smith

P.S. the next logical step would be to replace pgamma with TOMS654, as pgamma suffers from the same problems which the old pbeta did.

More information about the R-devel mailing list