R function pnorm() returns 0 when used in pval() function from the package "bacon"

206 views Asked by At

After running EWAS adjustment using the R package BACON, and extracting the p-values from the resulting object, I am finding that many of my results have P-values of 0 (literally 0 rather than a very small number that is being truncated). After some testing, it appears related to how P-values are extracted by bacon:

function (object, corrected = TRUE) 
{
    if (!corrected | any(is.na(bias(object))) | any(is.na(inflation(object)))) 
        pvalues <- 2 * pnorm(-abs(object@teststatistics))
    else {
        teststatistics <- t(t(object@teststatistics) - bias(object))
        teststatistics <- t(t(teststatistics)/inflation(object))
        pvalues <- 2 * pnorm(-abs(teststatistics), mean = 0, 
            sd = 1, lower.tail = TRUE, log.p = FALSE)
    }
    return(pvalues)
}

If a test statistic is small enough (around -37.5 from what I have tested), the pnorm() function returns 0. See my example:

> pnorm(-abs(-37.51925))
[1] 2.235906e-308
> pnorm(-abs(-38.51925))
[1] 0

This obviously can cause issues. How could I fix this?

Thank you.

0

There are 0 answers