首页 文章

用R调整Holm sidak

提问于
浏览
1

我很擅长使用R.我正在使用两个因素(交互)运行ANOVA并取得成功 . 接下来我想在小组比较之间进行 . 我知道这可以使用TukeyHSD命令 . 但是,我们的研究小组之前使用SigmaPlot运行统计数据,该统计数据使用Holm-Sidak方法 . 因此,我的主管希望我在R上运行Holm-Sidak,以便我们可以比较结果并确保它们是相同的 .

有谁知道如何做到这一点?我试过在网上搜索,但找不到答案 . 似乎我需要输入未调整的p值,以便我可以运行一些代码并返回调整后的p值,但我对这些未调整的p值应该来自哪里感到困惑 . 它们来自先运行成对测试吗?

我很感激任何指导 .

1 回答

  • 1

    来自Pierre Legendre的代码对R中的ANOVA执行Holm-Šidák调整:

    Sidak <- function(vecP)
    #
    # This function corrects a vector of probabilities for multiple testing
    # using the Bonferroni (1935) and Sidak (1967) corrections.
    #
    # References: Bonferroni (1935), Sidak (1967), Wright (1992).
    #
    # Bonferroni, C. E. 1935. Il calcolo delle assicurazioni su gruppi di teste. 
    # Pp. 13-60 in: Studi in onore del Professore Salvatore Ortu Carboni. Roma.
    #
    # Sidak, Z. 1967. Rectangular confidence regions for the means of multivariate 
    # normal distributions. Journal of the American Statistical Association 62:626-633.
    #
    # Wright, S. P. 1992. Adjusted P-values for simultaneous inference. 
    # Biometrics 48: 1005-1013. 
    #
    #                  Pierre Legendre, May 2007
    {
    k = length(vecP)
    
    vecPB = 0
    vecPS = 0
    
    for(i in 1:k) {
       bonf = vecP[i]*k
       if(bonf > 1) bonf=1
       vecPB = c(vecPB, bonf)
       vecPS = c(vecPS, (1-(1-vecP[i])^k))
       }
    #
    return(list(OriginalP=vecP, BonfP=vecPB[-1], SidakP=vecPS[-1]))
    }
    

    或者,您可以使用包dunn.test . 它会对您想要的类型进行多次比较,但是在等级总和上,并且可以选择使用 "method = sidak" 进行Holm-Šidák调整 .

相关问题