On Aug 28, 2011, at 11:37 AM, Ram H. Sharma wrote:

Dear R users:

Sorry for this simple question:

I am writing a function where I would need to pickup p values and make
-log10 of it.

The p values are from an anova output and sometime it can yield me 0.

-log10 (0)

[1] Inf

I can not replace Inf with 0, which not case here.

Well you could, but if you did, you would be shooting yourself in the foot.



This is restricting me to go further in the function and out me the error.
You help is highly appreciated.

I would think that one would be better served , not by trying to redefine the log of small numbers, but rather by first putting a lowering bound on the p-values.

pvec.trimmed <- pmax(pvec, 0.0000001)

min(log10(pvec.trimmed))   # now would be -7

The alternative that you suggest would be putting all of the p-values of 0 in the same locations as the p-values of 1 after log transformation. That cannot be a wise idea. Rather like redefining pi to be 3.14.

--
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to