Jessica
Jessica

Reputation: 461

Applying correction for multiple tests to get p-adjusted value

I have done multiple linear regression tests and got result. Here are a few rows of result:

Name    estimate    std.error   statistic   p.value Note
A1  0.0856767524298681  0.0126892271621709  6.7519283353432 1.33883410848243e-10    protein
A2  0.0369509779463753  0.00547265553056216 6.75192833534319    1.33883410848245e-10    protein
A3  0.0323211629170586  0.00478695289875522 6.75192833534319    1.33883410848246e-10    protein
A4  0.00213432164701004 0.000316105494757381    6.75192833534319    1.33883410848246e-10    protein
A5  0.010932202013597   0.00161912293357321 6.75192833534319    1.33883410848247e-10    Retrovirus

I want to run correction for multiple tests and get an additional column for adjusted p-value using p.adjust function. Thank you!

Upvotes: 1

Views: 2216

Answers (1)

C.Wang
C.Wang

Reputation: 196

Suppose df is your original data frame.

library(tidyverse)
df_add_padj <- df %>% mutate("adjusted p-value" = p.adjust(p.value, method="fdr"))

method can be fdr, bonferroni and etc.

Upvotes: 4

Related Questions