Skip to content
Prev 36726 / 63424 Next

results of pnorm as either NaN or Inf

Thank you for your responses. 

I presented a minimal example of the issue, but I should have explained
that this came up in the context of maximizing a log likelihood function
(with optim). I certainly agree that there would be no good reason for a
human to evaluate the function pnorm(-x, log.p=TRUE) for large x. However,
I would suggest that one may want the function to return a value of -Inf
for large x, rather than issue an error or a warning, as I'm guessing your
alteration of the C code would do. Returning a value of -Inf would allow an
optimization routine (or a pre-optimization-routine grid search) to know
that it's going into (or is currently in) the wrong region. I can
definitely see the counterargument that someone using an optimization
routine should think about the function they are optimizing more carefully,
especially given that there could be numerical issues. I think I'm not the
right person to judge, both because I don't know the programming issues nor
much about numerical optimization, but I wanted to offer a possible
argument for returning -Inf in case it hasn't already been considered, and
others can evaluate the issue. (In general, my earlier purpose was just to
point out what I thought might be an inconsistency in case people wanted to
change it. I'm not concerned about it for my own usage at all, since I can
just adjust my own programs.)

Thank you, and to all, thank you for all of your work on R.

Eric

On Fri, 14 May 2010 11:50:09 +0100 (BST), Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote: