Adding floating point precision to qnorm / pnorm?

I would be interested to increase the floating point limit for calculating qnorm / pnorm from their current level, for example:

 x <- pnorm(10) # 1 qnorm(x) # Inf qnorm(.9999999999999999444) # The highst limit I've found that still return a <<Inf number 

Is this possible (within a reasonable time)? If so, how?

+5
source share
1 answer

If the argument is in the upper tail, you can get more accurate accuracy by computing 1-p. Like this:

 > x = pnorm(10, lower.tail=F) > qnorm(x, lower.tail=F) 10 

I would expect (although I don’t know for sure) that the pnorm () function refers to a C or Fortran routine that is stuck at any floating point size supported by the hardware. It might be better to rebuild your problem so that accuracy is not needed.

Then, if you are dealing with really large z values, you can use log.p = T:

 > qnorm(pnorm(100, low=F, log=T), low=F, log=T) 100 

Sorry, this is not exactly what you are looking for. But I think it will be more scalable - pnorm quickly hits 1 with high z values ​​(after all, it's e ^ (- x ^ 2)), that even if you add more bits, they will quickly run out.

+10
source

All Articles