This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Adjust pvalue in R with different approach give me all different outcome

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:

  1. p.adjust(pval_matrix, method='fdr', n=10)
  2. p.adjust(0.1539985, method='fdr', n=10) --> do same thing to all those 10 individual pvalue and make a new matrix for p.adjust
  3. lapply(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

statistics r p-value
  • p.adjust() is supposed to receive a numeric vector of p-values, not a matrix.
  • It makes no sense to "adjust" just one p-value, as you did in number (2). The whole idea of adjusting is adjusting for multiple experiments, how can you adjust a single experiment?
  • It can be most helpful to read the help page ?p.adjust, which says for example

n: number of comparisons, must be at least length(p); only set this (to non-default) when you know what you are doing!

0 answers

No answers yet.

Log in to answer this question.