unexpect results from p.adjust?
0
0
Entering edit mode
8.7 years ago
star ▴ 350

I like to adjust my p-value results, but when I use p.adjust() function I get unexpected results as below:

df$HW_pval.adj <- p.adjust(df$HW_pval, method = "BH")

input: df

       SNP                      HW_pval         
1 10 112046150    1.37831825318596e-49           
2  10 12292454     5.11437528649252e-39           
3  10 73576307     0.747604763130749                
4  10 73994765    3.16878102556126e-31           
5  10 75881676    2.08828540782082e-40          
6  10 91066769    1.16740014071809e-34

output:

df

  SNP                     HW_pval           HW_pval.adj
1 10 112046150    1.37831825318596e-49           1
2  10 12292454     5.11437528649252e-39          1
3  10 73576307     0.747604763130749             1
4  10 73994765    3.16878102556126e-31           1
5  10 75881676    2.08828540782082e-40           1
6  10 91066769    1.16740014071809e-34           1
R p.adjust p-value • 1.6k views
ADD COMMENT
1
Entering edit mode

could you do is(df$HW_pval) ?

ADD REPLY
0
Entering edit mode

is(df$HW_pval) [1] "factor" "integer" "oldClass" "numeric" "vector"

ADD REPLY
3
Entering edit mode

There's your problem. That column is being seen as a factor rather than a float with df$HW_pval <- as.numeric(as.character(df$HW_pval)).

ADD REPLY
1
Entering edit mode

this answer is correct. Moreover, it would be good to check the reason why the column is a factor instead of a numeric. Maybe some of the rows contain characters or invalid data for that column, causing R to think it is a character column. It would be better to track down the error and fix it.

ADD REPLY
0
Entering edit mode

What does hist(df$HW_pval) look like?

ADD REPLY

Login before adding your answer.

Traffic: 1642 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