I have some raw p-values and I would like to do Benjamini Hochberg and Bonferoni correction? Does anyone know how to do it - step by step? I have my p-values as txt files. And how can I check it, whether it is right or not.
Thanks Martin
I have some raw p-values and I would like to do Benjamini Hochberg and Bonferoni correction? Does anyone know how to do it - step by step? I have my p-values as txt files. And how can I check it, whether it is right or not.
Thanks Martin
I would like to add a cautionary note about the above answer here, regarding the nonmonotonocity of q-values (corrected p-values) that would result from the formula.
The source code for the p.adjust function in R is here:
BH = { i <- lp:1L o <- order(p, decreasing = TRUE) ro <- order(o) pmin(1, cummin(n/i * p[o]))[ro]}
Which fixes this issue in the last line.
You can use a function in R,p.adjust.
pBenjaminiHochberg = min( p * n / r , 1)
where p is the original p-value, n is the number of computed p-values in total and r is the rank of the original p-value when p-values are sorted in ascending order.
It should be possible to do the manipulations manually in Excel, but if you can use R, there is the p.adj function that is more straightforward.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Sorry
pBenjaminiHochberg = min(0,00002 * 5 / 1) = 0,0001 pBenjaminiHochberg = min(0,00034 * 5 / 2) = 0,00085 pBenjaminiHochberg = min(0,0024 * 5 / 3) = 0,004 pBenjaminiHochberg = min(0,0235 * 5 / 4) = 0,029375 pBenjaminiHochberg = min(0,12424 * 5 / 5) = 0,12424
It looks correct. I did the test in R and I have the same results :
@ lampardmartin3 : Please use
ADD COMMENT/ADD REPLY
when responding to existing posts to keep threads logically organized.SUBMIT ANSWER
should be used for NEW answers to original question.