【问题标题】:Summarizing list of pairwise statistical tests成对统计检验的总结列表
【发布时间】:2016-03-05 21:26:51
【问题描述】:

简介

在执行 ANOVA 后,我们通常会执行一系列成对比较。当组数比较多的时候,pairwise comparison的个数就变得很大(就是它的triangular number)。在图表上,通常通过用相同的字母标记组来表示没有显着差异的组,因此有一个可以产生这些字母的函数会很方便。

目标

我正在尝试在R 中构建一个函数来接收输入

  • TukeyHSD(aov(y~x)) 的输出
  • alpha 值

.. 并且会输出

  • 字符串列表,指示哪些组显着不同,哪些组没有显着差异。

示例

set.seed(10)
d = data.frame(
    y=c(rnorm(100,10),rnorm(100,10),rnorm(100,8.5),rnorm(100,8)),
    x=rep(c("High","MidHigh", "MidLow","Low"), each=100)
)

z=TukeyHSD(aov(y~x,data=d))
z
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = y ~ x, data = d)

$x
                      diff         lwr        upr     p adj
Low-High       -1.66461230 -2.02288676 -1.3063378 0.0000000
MidHigh-High    0.04158636 -0.31668810  0.3998608 0.9906564
MidLow-High    -1.33469921 -1.69297367 -0.9764247 0.0000000
MidHigh-Low     1.70619866  1.34792420  2.0644731 0.0000000
MidLow-Low      0.32991309 -0.02836138  0.6881876 0.0834543
MidLow-MidHigh -1.37628557 -1.73456004 -1.0180111 0.0000000

这就是fun 的功能

fun(Tukey=z, alpha=0.05)
High MidHigh  MidLow     Low 
"A"     "A"     "B"     "B" 

fun(Tukey=z, alpha=0.1)
High MidHigh  MidLow     Low 
"A"     "A"     "B"     "C" 

【问题讨论】:

    标签: r statistics permutation


    【解决方案1】:

    试试multcompView 包。

    library(multcompView)
    multcompLetters(z$x[,4])
    ##    Low MidHigh  MidLow    High 
    ##    "a"     "b"     "a"     "b" 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-15
      • 1970-01-01
      • 1970-01-01
      • 2017-05-15
      相关资源
      最近更新 更多