Adjust pvalue in R with different approach give me all different outcome
0
0
Entering edit mode
7 months ago

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 • 429 views
ADD COMMENT
1
Entering edit mode
  • 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!

ADD REPLY

Login before adding your answer.

Traffic: 1898 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6