Entering edit mode
7 months ago
Jonathan Yoou
▴
60
Hi all,
I'm trying to calculate adjusted pvalue in R. Let's say I have pvalues of spearman correlation from 5 genes and 2 metabolites (10 tests were happened). I can make the outcome into matrix below:
Metabolite1 Metabolite2
Gene1 0.1539985 0.889662
Gene2 0.3576396 0.433484
Gene3 0.511551 0.9262647
Gene4 0.6669462 0.4057542
Gene5 0.4910232 0.3086241
Now, I want to calculate adjusted pvalue using FDR correction. Here is the approach I tried:
p.adjust(pval_matrix, method='fdr', n=10)
p.adjust(0.1539985, method='fdr', n=10)
--> do same thing to all those 10 individual pvalue and make a new matrix for p.adjustlapply(pval_matrix %>% as.data.frame(), function(x) p.adjust(x, method='fdr', n=10))
The thing is all those approach give me all different outcomes.
I have no idea why, and which one is the correct one.
It would be great help from any of your opinions or knowledge!
Thank you in advance
p.adjust()
is supposed to receive a numeric vector of p-values, not a matrix.?p.adjust
, which says for example