在multcomp中更改Dunnett glht的控制组

时间:2017-11-21 15:21:12

标签: r statistics

我想知道是否有人知道如何在多组合中对Dunnett测试的对照治疗组之间进行更改?通过第一次处理按字母/数字方式选择对照处理。我有几组数据,如果我可以简单地使用代码进行编辑,我宁愿不进行编辑,另外我有两个控件我想比较我的实验性处理。

例如,我的“数据”

TrtName Block   Trt X3dpi   X6dpi   X12dpi
Neg_ctrl    1   1   1   4   8
Neg_ctrl    1   1   1   3   8
Neg_ctrl    1   1   2   4   9
Neg_ctrl    2   1   1   3   9
Neg_ctrl    2   1   1   4   8
Neg_ctrl    2   1   1   5   9
TC_ctrl 1   2   2   5   9
TC_ctrl 1   2   2   5   9
TC_ctrl 1   2   1   4   9
TC_ctrl 2   2   1   3   7
TC_ctrl 2   2   2   4   9
TC_ctrl 2   2   2   3   8
D_112   1   3   0   1   5
D_112   1   3   0   1   4
D_112   1   3   1   2   5
D_112   2   3   0   2   5
D_112   2   3   1   1   3
D_112   2   3   1   2   4
D_332   1   4   0   1   5
D_332   1   4   0   2   5
D_332   1   4   1   2   4
D_332   2   4   0   2   5
D_332   2   4   1   3   6
D_332   2   4   2   4   7
J_045   1   5   2   5   9
J_045   1   5   2   5   8
J_045   1   5   1   4   8
J_045   2   5   2   5   9
J_045   2   5   1   5   8
J_045   2   5   1   3   8
J_185   1   6   2   5   8
J_185   1   6   1   4   
J_185   1   6   2   4   8
J_185   2   6   0   3   9
J_185   2   6   2   5   9
J_185   2   6   2   4   9
J_185   2   6   1   3   8

我正在使用的代码:

FHBficFit3dpi <- aov(X3dpi~ TrtName, FHBficData)
set.seed(115)
FHBficDunnett3dpi <- glht(model = FHBficFit3dpi, linfct=mcp(TrtName="Dunnett"))
summary(FHBficDunnett3dpi)

结果:     一般线性假设的同时测试

Multiple Comparisons of Means: Dunnett Contrasts


Fit: aov(formula = X3dpi ~ TrtName, data = FHBficData)

Linear Hypotheses:
                  Estimate Std. Error t value Pr(>|t|)  
D_332 - D_112 == 0      0.1667     0.3624   0.460   0.9873  
J_045 - D_112 == 0      1.0000     0.3624   2.759   0.0390 *
J_185 - D_112 == 0      0.9286     0.3492   2.659   0.0489 *
Neg_ctrl - D_112 == 0   0.6667     0.3624   1.840   0.2534  
TC_ctrl - D_112 == 0    1.1667     0.3624   3.219   0.0128 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)

我意识到将模型更改为“X3dpi~Trt”会导致正确的比较,但我也想将每个处理方法与TC_ctrl组进行比较。

1 个答案:

答案 0 :(得分:0)

尝试一下:更改因子的顺序,然后将所需的组放在第一位:

FHBficData$TrtName<-factor(FHBficData$TrtName,levels=c("TC_ctrl","D_332","J_045","J_185","Neg_ctrl","D_112"),ordered=TRUE)
FHBficFit3dpi <- aov(X3dpi~ TrtName, FHBficData)
set.seed(115)
FHBficDunnett3dpi <- glht(model = FHBficFit3dpi, linfct=mcp(TrtName="Dunnett"))
summary(FHBficDunnett3dpi)

您会得到的:

     Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Dunnett Contrasts


Fit: aov(formula = X3dpi ~ TrtName, data = FHBficData)

Linear Hypotheses:
                        Estimate Std. Error t value Pr(>|t|)  
D_332 - TC_ctrl == 0     -1.0000     0.3624  -2.759   0.0391 *
J_045 - TC_ctrl == 0     -0.1667     0.3624  -0.460   0.9873  
J_185 - TC_ctrl == 0     -0.2381     0.3492  -0.682   0.9361  
Neg_ctrl - TC_ctrl == 0  -0.5000     0.3624  -1.380   0.5114  
D_112 - TC_ctrl == 0     -1.1667     0.3624  -3.219   0.0128 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)