如何使用 Dunnett 程序与 R 中的控件进行多重比较?

How to make multiple comparison with a control in R using Dunnett procedure?

我有以下实验数据

> spears
   treatment length
1    Control   94.7
2    Control   96.1
3    Control   86.5
4    Control   98.5
5    Control   94.9
6        IAA   89.9
7        IAA   94.0
8        IAA   99.1
9        IAA   92.8
10       IAA   99.4
11       ABA   96.8
12       ABA   87.8
13       ABA   89.1
14       ABA   91.1
15       ABA   89.4
16       GA3   99.1
17       GA3   95.3
18       GA3   94.6
19       GA3   93.1
20       GA3   95.7
21      CPPU  104.4
22      CPPU   98.9
23      CPPU   98.9
24      CPPU  106.5
25      CPPU  104.8

我想使用以下代码将所有治疗与“对照”治疗进行比较

mod0 <-aov( length ~ treatment, data = spears)
summary(mod0)

library(multcomp)
spears_dun <- glht(mod0,linfct = mcp(treatment = "Dunnett"), alternative = "greater")
summary(spears_dun)

然而,它是以字母顺序 (ABA) 中的第一个治疗作为对照,而不是“对照”治疗。

结果如下

Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Dunnett Contrasts


Fit: aov(formula = length ~ treatment, data = spears)

Linear Hypotheses:
               Estimate Std. Error t value Pr(>t)    
Control - ABA <= 0    3.300      2.325   1.419 0.2240    
CPPU - ABA <= 0      11.860      2.325   5.101 <0.001 ***
GA3 - ABA <= 0        4.720      2.325   2.030 0.0833 .  
IAA - ABA <= 0        4.200      2.325   1.806 0.1230    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)

如何与“对照”进行比较?

谢谢。

treatment 列必须是一个因子,您必须将其参考水平设置为 "Control",使用 relevel 函数:

library(multcomp)

dat <- data.frame(
  treatment = c("Control", "Control", "ABA", "ABA", "X", "X"),
  length = c(1, 2, 3, 4, 5, 6),
  stringsAsFactors = TRUE
)
dat$treatment <- relevel(dat$treatment, ref = "Control")

amod <- aov(length ~ treatment, data = dat)
glht(amod, linfct = mcp(treatment = "Dunnett"))

当你将它作为任何你喜欢的顺序的一个因素时,你可以强制处理对比度水平,第一个将是基础。

spears$treatment <- factor(spears$treatment, 
                          levels = c("Control", "ABA", "CPPU", "GA3", "IAA"))

contrasts(spears$treatment)
#>         ABA CPPU GA3 IAA
#> Control   0    0   0   0
#> ABA       1    0   0   0
#> CPPU      0    1   0   0
#> GA3       0    0   1   0
#> IAA       0    0   0   1

mod0 <-aov( length ~ treatment, data = spears)

library(multcomp)

spears_dun <- glht(mod0,linfct = mcp(treatment = "Dunnett"), alternative = "greater")

summary(spears_dun)
#> 
#>   Simultaneous Tests for General Linear Hypotheses
#> 
#> Multiple Comparisons of Means: Dunnett Contrasts
#> 
#> 
#> Fit: aov(formula = length ~ treatment, data = spears)
#> 
#> Linear Hypotheses:
#>                     Estimate Std. Error t value  Pr(>t)   
#> ABA - Control <= 0    -3.300      2.325  -1.419 0.99232   
#> CPPU - Control <= 0    8.560      2.325   3.682 0.00272 **
#> GA3 - Control <= 0     1.420      2.325   0.611 0.55407   
#> IAA - Control <= 0     0.900      2.325   0.387 0.65279   
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> (Adjusted p values reported -- single-step method)