Reputation: 869
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.
Upvotes: 1
Views: 1133
Reputation: 43
When using a smaller n in this way you may end up with p-values that are smaller than their unadjusted counterpart. To avoid this I suggest you can add an additional check to force the new p-values to be minimum the unadjusted p, just before the return of p0:
p0 <- ifelse(p0 < p, p, p0)
Upvotes: 1
Reputation: 263332
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
Upvotes: 6