美文网首页
R: p value矫正

R: p value矫正

作者: 胡童远 | 来源:发表于2021-08-20 11:01 被阅读0次

    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)
    

    更多
    R语言中dnorm, pnorm, qnorm与rnorm以及随机数

    相关文章

      网友评论

          本文标题:R: p value矫正

          本文链接:https://www.haomeiwen.com/subject/knttiltx.html