4
1
Entering edit mode
4.9 years ago

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

R • 5.7k views
0
Entering edit mode

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

0
Entering edit mode

It looks correct. I did the test in R and I have the same results :

p.adjust(c( 0.00002, 0.00034,0.0024, 0.0235, 0.12424),method="fdr")
 0.000100 0.000850 0.004000 0.029375 0.124240

0
Entering edit mode

@ 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.

2
Entering edit mode
4.9 years ago
Noushin N ▴ 590

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.

1
Entering edit mode
4.9 years ago
zjhzwang ▴ 180

You can use a function in R,p.adjust.

0
Entering edit mode

thank you

I not trained in using R (at least not now)

0
Entering edit mode
4.9 years ago
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.