p.adjust 提供多种矫正方法:
Adjust P-values for Multiple Comparisons
"holm", "hochberg", "hommel", "bonferroni", "BH", "BY","fdr"
1 模拟p value
The Normal Distribution
rnorm(n, mean = 0, sd = 1) random 函数,生成随机数,底物
dnorm(x, mean = 0, sd = 1) density 函数
pnorm(q, mean = 0, sd = 1) probability 函数
qnorm(p, mean = 0, sd = 1) quantile 函数
set.seed(123)
x <- rnorm(50, mean = c(rep(0, 25), rep(3, 25)))
p <- 2*pnorm(sort(-abs(x)))
round(p, 3)
2 Bonferroni矫正
round(p.adjust(p, "bonferroni"), 3)
# 或者
round(p.adjust(p, method = "bonferroni", n = length(p)), 3)
3 FDR矫正
round(p.adjust(p, "fdr"), 3)
# 或者
round(p.adjust(p, method = "fdr", n = length(p)), 3)
网友评论