This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Inverse of -log(p)

I've got some data with p values expressed as -log(p). How do I invert this to the p values?

I've read here about undoing -log10(p):

How can I convert -log10 (p-value) to p-value?

p <- 0.01
logp <- -log10(p)
10^-logp

Here are some example -log(p) in the table:

1.542108761
1.760644949
1.567865477
1.779197974

Is it:

exp(1)^(-logp)

Thanks!

r statistics log-p

Hi Michael,

The correct transformation would be: 1/exp( )

The proof:

p=0.05
result <- -log(p)
1/exp(result)
[1] 0.05

p=0.0034
result <- -log(p)
1/exp(result)
[1] 0.0034

p=0.0000023
result <- -log(p)
1/exp(result)
[1] 2.3e-06
options(scipen=999)
1/exp(result)
[1] 0.0000023

Kind regards / Cordiali saluti,
Kevin

Moved back to comment, as I had interpreted that the log transformation under question was natural log (log e).

1 answer

In base 10, it should be:

1/(10^num1)

From example:

p = .05
num1 = -log10(p)
1/(10^num1)
[1] 0.05

Thank you Sir. Indeed, it is log base 10.

Log in to answer this question.