Reputation: 425
I am trying to use the R package multtest to adjust a list of p-values for multiple testing. However, multtest will only return a list of "1" characters of equal length to the list of p-values that were analyzed.
The input file is a text file in which the pvalues are separated by newline characters. A segment of the file is reproduced below:
0.182942602
0.333002877
0.282000206
0.161501682
0.161501682
I downloaded the multtest package (multtest_2.14.0) from Bioconductor, and am running it in R version x64 2.15.2. Does anyone know if there is a compatibility problem between multtest and R 2.15.2?
My code:
library(multtest, verbose = FALSE)
table1 <- read.table("p-values.txt", header = FALSE, colClasses = "double")
table2 <-as.vector(as.double(table1[,1]))
results<-p.adjust(table2, method = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"))
write.table(results, file = "output.txt")
Upvotes: 1
Views: 674
Reputation: 78600
This is not an error- this is the correct adjustment when there are no p-values that can be considered significant within that vector of p-values.
Your code performs the Holm correction (method
takes only one argument, and in this case will use the "holm"
method, the first item in your vector). The Holm method will correctly return all ones in the case that
min(p) * length(p) > 1
In that situation (using this multiple hypothesis testing framework), there are no p-values in the vector that can be considered significant.
If you'd like to see the gory details, the code for the holm
method (taken directly from the multtest package) is
i <- seq_len(lp)
o <- order(p)
ro <- order(o)
pmin(1, cummax((n - i + 1L) * p[o]))[ro]
where p
is the input vector, and lp
and n
are the length of the vector. That expression (n - i + 1L) * p[o]
is saying "for each item in the sorted list, take n+1
minus its index, then multiply it by the value". For the minimum item, that is (n + 1 - 1) * min(p)
-> n * min(p)
. The cummax
means the cumulative maximum- which means that none of the subsequent items can be smaller than the first value. And pmin(1, ...)
means that for every item in the vector, if the item is greater than 1, set the value equal to 1 (since a p-value about 1 is meaningless).
This means that if n * min(p)
is greater than one, then the adjusted p-value of the smallest item is 1, which means the adjusted p-value of every item must be 1.
Upvotes: 1