[Rd] pt inaccurate when x is close to 0 (PR#9945)

Thomas Lumley tlumley at u.washington.edu
Thu Oct 11 16:21:32 CEST 2007

On Wed, 10 Oct 2007, Duncan Murdoch wrote:>
> As Charles Berry told you when this was posted to R-help, it looks as
> though it is Mathematica that is inaccurate.  For example, I would
> expect this plot to be smooth, and it is not in either R or Mathematica,
> but R is at least monotone:

I did check this on Maple by integrating the density function and got 
about 11-12 digits accuracy at df=88.  I also tried replacing 1e-4 with an 
exactly-representable number (3/32768), with a similar accuracy level.

pbeta() claims 14-digit accuracy and is called by pt() with 1/(1+x^2/n) as 
its argument.  I would have thought that the 1/(1+x^2/n) could easily be 
responsible for this sort of accuracy loss when x=1e-4.  If so, it may not 
be easy to improve.


More information about the R-devel mailing list