[R] What are the pros and cons of the log.p parameter in (p|q)norm and similar?

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Tue Aug 3 20:53:28 CEST 2021

On 03/08/2021 12:20 p.m., Michael Dewey wrote:
> Short version
> Apart from the ability to work with values of p too small to be of much
> practical use what are the advantages and disadvantages of setting this
> to TRUE?
> Longer version
> I am contemplating upgrading various functions in one of my packages to
> use this and as far as I can see it would only have the advantage of
> allowing people to use very small p-values but before I go ahead have I
> missed anything? I am most concerned with negatives but if there is any
> other advantage I would mention that in the vignette. I am not concerned
> about speed or the extra effort in coding and expanding the documentation.

These are often needed in likelihood problems.  In just about any 
problem where the normal density shows up in the likelihood, you're 
better off working with the log likelihood and setting log = TRUE in 
dnorm, because sometimes you want to evaluate the likelihood very far 
from its mode.

The same sort of thing happens with pnorm for similar reasons.  Some 
likelihoods involve normal integrals and will need it.

I can't think of an example for qnorm off the top of my head, but I 
imagine there are some:  maybe involving simulation way out in the tails.

The main negative about using logs is that they aren't always needed.

Duncan Murdoch

More information about the R-help mailing list