Skip to content
Prev 36707 / 63424 Next

results of pnorm as either NaN or Inf

On 13-May-10 20:04:50, efreeman at berkeley.edu wrote:
This is probably platform-independent. I get the same results with
R on Linux. More to the point:

You are clearly "pushing the envelope" here. First, have a look
at what R makes of your inputs to pnorm():

  -1.0e+307
  # [1] -1e+307
  -1.0e+308
  # [1] -1e+308
  -1.0e+309
  # [1] -Inf


So, somewhere beteen -1e+308 and -1.0e+309. the envelope burst!
Given -1.0e+309, R returns -Inf (i.e. R can no longer represent
this internally as a finite number).

Now look at

  pnorm(-Inf,log.p=TRUE)
  # [1] -Inf

So, R knows how to give the correct answer (an exact 0, or -Inf
on the log scale) if you feed pnorm() with -Inf. So you're OK
with -1e+N where N >= 309.

For smaller powers, e.g. -1e+(200:306), these give pnorm() much
less than -1.0e+309, and presumably R's algorithm (which I haven't
studied either ... ) returns 0 for pnorm(), as it should to the
available internal accuracy.

So, up to pnorm(-1.0e+307, log.p=TRUE) = -Inf. All is as it should be.
However, at -1e+308, "the envelope is about to burst", and something
may occur within the algorithm which results in a NaN.

So there is nothing anomalous about your results except at -1e+308,
which is where R is at a critical point.

That's how I see it, anway!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 14-May-10                                       Time: 00:01:27
------------------------------ XFMail ------------------------------