0

我已经在 stats.exchange (原始问题)上问过这个问题,现在我在这里重新发布了相同的内容 - 希望能从更广泛的人群中获得帮助。


我想知道如何从双向 ANOVA 生成的输出中排除所有不需要的对,因此当摘要(aov())显示显着结果时,事后测试不会给我任何比较我不想要。详情如下:

我包含两个因素(四个级别:A、B、C、D)和(两个级别:控制和处理)datTable下的比例数据。具体来说,我想在每个相同的(例如 control-A VS. control-B、control-A VS.control-C、treatment-A VS.treatment-C 等)下进行成对测试,而排除不同和不同之间的比较(例如,对照-A VS.处理-B,对照-B VS.处理-C)。sitetreatmentsitetreatmentsitestreatments

数据如下所示:

> datTable
   site treatment proportion
     A   control  0.5000000
     A   control  0.4444444
     A   treated  0.1000000
     A   treated  0.4000000
     B   control  0.4444444
     B   control  0.4782609
     B   treated  0.0500000
     B   treated  0.3000000
     C   control  0.3214286
     C   control  0.4705882
     C   treated  0.1200000
     C   treated  0.4000000
     D   control  0.3928571
     D   control  0.4782609
     D   treated  0.4000000
     D   treated  0.4100000

我做了一个双向方差分析(也不确定是在主题内site/treatment还是在主题之间使用site*treatment......),并总结了结果。

  m1 <- aov(proportion~site*treatment,data=datTable) # Or should I use 'site/treatment'?

然后我summary(m1)给了我以下内容:

> summary(m1)
               Df  Sum Sq Mean Sq F value Pr(>F)  
site            3 0.02548 0.00849   0.513 0.6845  
treatment       1 0.11395 0.11395   6.886 0.0305 *
site:treatment  3 0.03686 0.01229   0.742 0.5561  
Residuals       8 0.13239 0.01655                 

下一步是使用TukeyHSD事后测试来查看究竟是哪对导致了因素的*显着性site

> TukeyHSD(m1)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = proportion ~ site * treatment, data = datTable)

$site
            diff        lwr       upr     p adj
B-A -0.042934783 -0.3342280 0.2483585 0.9631797
C-A -0.033106909 -0.3244002 0.2581863 0.9823452
D-A  0.059168392 -0.2321249 0.3504616 0.9124774
C-B  0.009827873 -0.2814654 0.3011211 0.9995090
D-B  0.102103175 -0.1891901 0.3933964 0.6869754
D-C  0.092275301 -0.1990179 0.3835685 0.7461309

$treatment
                      diff        lwr         upr     p adj
treated-control -0.1687856 -0.3171079 -0.02046328 0.0304535

$`site:treatment`
                            diff        lwr       upr     p adj
B:control-A:control -0.010869565 -0.5199109 0.4981718 1.0000000
C:control-A:control -0.076213819 -0.5852551 0.4328275 0.9979611
D:control-A:control -0.036663216 -0.5457045 0.4723781 0.9999828
A:treated-A:control -0.222222222 -0.7312635 0.2868191 0.6749021
B:treated-A:control -0.297222222 -0.8062635 0.2118191 0.3863364  # Not wanted
C:treated-A:control -0.212222222 -0.7212635 0.2968191 0.7154690  # Not wanted
D:treated-A:control -0.067222222 -0.5762635 0.4418191 0.9990671  # Not wanted
C:control-B:control -0.065344254 -0.5743856 0.4436971 0.9992203
D:control-B:control -0.025793651 -0.5348350 0.4832477 0.9999985
A:treated-B:control -0.211352657 -0.7203940 0.2976887 0.7189552  # Not wanted
B:treated-B:control -0.286352657 -0.7953940 0.2226887 0.4233804  # Not wanted
C:treated-B:control -0.201352657 -0.7103940 0.3076887 0.7583437  # Not wanted
D:treated-B:control -0.056352657 -0.5653940 0.4526887 0.9996991
D:control-C:control  0.039550603 -0.4694907 0.5485919 0.9999713
A:treated-C:control -0.146008403 -0.6550497 0.3630329 0.9304819  # Not wanted
B:treated-C:control -0.221008403 -0.7300497 0.2880329 0.6798628  # Not wanted
C:treated-C:control -0.136008403 -0.6450497 0.3730329 0.9499131 
D:treated-C:control  0.008991597 -0.5000497 0.5180329 1.0000000  # Not wanted
A:treated-D:control -0.185559006 -0.6946003 0.3234823 0.8168230  # Not wanted
B:treated-D:control -0.260559006 -0.7696003 0.2484823 0.5194129  # Not wanted
C:treated-D:control -0.175559006 -0.6846003 0.3334823 0.8505865  # Not wanted
D:treated-D:control -0.030559006 -0.5396003 0.4784823 0.9999950  
B:treated-A:treated -0.075000000 -0.5840413 0.4340413 0.9981528
C:treated-A:treated  0.010000000 -0.4990413 0.5190413 1.0000000
D:treated-A:treated  0.155000000 -0.3540413 0.6640413 0.9096378
C:treated-B:treated  0.085000000 -0.4240413 0.5940413 0.9960560
D:treated-B:treated  0.230000000 -0.2790413 0.7390413 0.6429921
D:treated-C:treated  0.145000000 -0.3640413 0.6540413 0.9326207

但是,有一些我不想包含在我执行的双向 ANOVA 中,指定为# not wanted.

有什么方法可以调整aovorTukeyHSD函数来排除我上面列出的那些可能性(“不想要的”)?我可以很容易地*TukeyHSD. 但我不希望我的方差分析结果受到那些偏见!(在真实数据中,那些不想要的对实际上引起的重要性发生在!)

注意:您可能已经注意到site:treatment事后测试没有任何意义,这是因为我只从原始数据中选择了一个小样本。

4

1 回答 1

0

如果您的意思是从计算中完全排除这些比较,Tukey 的测试通过对所有条件组合进行成对比较来工作。“排除”任何对是没有意义的。

如果您的意思是要从最终结果中排除不需要的比较,那么是的,这是可能的。TukeyHSD 的结果只是一个列表,site:treatment只是一个矩阵,您可以随意操作它。

lst <- TukeyHSD(m1)
lst[['site:treatment']] <- lst[['site:treatment']][-c(5,6,7,10,11,12,15,16,18,19,20,21),]
于 2015-11-05T09:55:24.163 回答