I have many kmers counts from different prokaryotes, and I use a high markov order to obtain the expected counts to compare with the observed counts. And for look for over/under represented kmers counts I use z-scores. From z-scores I calculate my p-values and then e-values. So Iuse threshold e-value = 0.001 to select the extremes words/kmers.

However I got some 0.0 p-values/e-values for very extreme z-scores, due underflow.

Can I use a p-values that do not cause underflow to avoid the 0 values? For example, 1.0e-323 (the one that do not give 0 in my machine) when the p-value is zero? like: if p-val == 0, then 1.0e-323 else the p-val non zero? I use this function to calculate my p-values:

pval <- function(kmer_list, kmer_data){
    n <- nrow(kmer_data)
    for(i in 1:n){
        zsc <- kmer_data[which(kmer_data$kmer == kmer_list[i]), 
        pval <- pnorm(-abs(zsc)) * 2
        **# maybe the if statement as above?**
        kmer_data[i, "Pval"] <- pval

This solution is a valid statistical approach? Or I don't care and keep the zero p-values and zero e-values anyway?

I really appreciate any input.

  • 1
    $\begingroup$ Typically if a p-value is smaller than some value, we report it as e.g. p < 0.001 or p < 0.0001. If it's important to report smaller p-values, I suppose you could report e.g. p < 1e-299. $\endgroup$ Oct 31, 2022 at 19:19
  • 1
    $\begingroup$ If you are having issues with accuracy of floating-point numbers, a common approach is to switch to the log-scale. Conveniently, the pnorm function has a log.p argument. $\endgroup$
    – Roland
    Nov 1, 2022 at 7:08
  • $\begingroup$ @Roland I will check it out. Thank you $\endgroup$ Nov 1, 2022 at 14:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.