[Rd] R_DT_val accuracy (PR#6692)
terra at gnome.org
terra at gnome.org
Wed Mar 24 15:53:21 CET 2004
Full_Name: M. Welinder
Version: 1.8.1
OS: Solaris
Submission from: (NULL) (65.213.85.227)
Currently R has...
#define R_D_Lval(p) (lower_tail ? (p) : (1 - (p))) /* p */
#define R_D_val(x) (log_p ? log(x) : (x)) /* x in pF(x,..) */
#define R_DT_val(x) R_D_val(R_D_Lval(x)) /* x in pF */
...which is sub-optimal in the lower_tail==FALSE && log_p==TRUE case.
Something like this ought to work better.
#define R_DT_val(x) (log_p ? (lower_tail ? log(x) : log1p (-(x))) :
(R_D_Lval(x)))
Similarly for R_DT_Cval.
This affects the accuracy of phyper, for example.
More information about the R-devel
mailing list