🚨 You run an increased risk of Type I errors (a “false positive”) when multiple hypotheses are tested simultaneously. 🚨
Use the p.adjust()
function on a vector of p values. Use method =
to specify the adjustment method:
my_pvalues <- c(0.049, 0.001, 0.31, 0.00001)
p.adjust(my_pvalues, method = "BH") # Benjamini Hochberg
[1] 0.06533333 0.00200000 0.31000000 0.00004000
p.adjust(my_pvalues, method = "bonferroni") # multiply by number of tests
[1] 0.19600 0.00400 1.00000 0.00004
my_pvalues * 4
[1] 0.19600 0.00400 1.24000 0.00004
See here for more about multiple testing correction. Bonferroni also often done as p value threshold divided by number of tests (0.05/test number).