rbioconductorp-valuegenome

p.adjust with n < than number of tests


I would like to apply the p.adjust function in R where n is < number of p-values. The real number of independent tests is lower than the number of p-values as it cames from genomic data with Linkage Desequilibrium Desequilibrium (effective number of independent tests, Meff).

However, the p.adjust function do not allows it: number of comparisons, must be at least length(p).

Someone knows how to change this default in function or other generic function to accomplish similar work? Thank you!

Followed Steps:

1 - 3242 tested markers = 3242 p-values

2 - Inferred Meff is: 1096 (http://simplem.sourceforge.net/ procedure)

Now I need to estimate the corrected treshould or corrected p-values based on Meff.

I am not sure which multiple test correction strategy fits better or how to apply it in my data.


Solution

  • The code:

      p.adjust # typed at command line prints out the code
      # copy the body of the function
    

    ... is really very simple and all R. Just redefine a function that comments out that stopifnot() line:

    my.p.adj <- function (p, method = p.adjust.methods, n = length(p)) 
     # paste the body and edit this:
    ....
    p <- p[nna]
    lp <- length(p)
    # stopifnot(n >= lp)
    if (n <= 1) 
    ....  # hit enter