TukeyHSD具体情况

TukeyHSD specific conditions

我试图在 R 中将 TukeyHSD 设为 运行,我的代码如下所示:

#----------------------------------------------------------------------------------------#
# RING data:
#----------------------------------------------------------------------------------------#
library(doBy)
# Set working directory
setwd("")

#### Read data & Converting factors ####
dat <- read.table("afstand.txt", header =TRUE)  
str(dat)
dat$Vial <- as.factor(dat$Vial)
dat$Line <- as.factor(dat$Line)
dat$Fly <- as.factor(dat$Fly)  
dat$Temp <- as.factor(dat$Temp)
str(dat)

datSUM <- summaryBy(X0.5_sec+X1_sec+X1.5_sec+X2_sec+X2.5_sec+X3_sec~Vial_nr+Concentration+Sex+Line+Vial+Temp,data=dat, FUN=sum)
fl<-levels(datSUM$Line)
aov1 <- aov(X0.5_sec.sum ~ Concentration*Sex*Line*Temp, data=datSUM)
summary(aov1) #Overview of model 
TukeyHSD(aov1, 'Line',ordered = TRUE, conf.level = 0.95)

我想做的是查看 Line 和 Temp 之间的交互,但是如果我 运行 TukeyHSD(aov1) 然后我得到所有的交互,导致这个错误:[ reached getOption("max.print") -- omitted 3716 rows ] 有没有一种方法可以指定我只想在 Line 和 Temp 之间而不是所有组合之间进行测试,或者如果我只是 运行 TukeyHSD(avo1) 则只显示重要结果的方法? 我试过使用 TukeyHSD(aov1, 'Line,Temp',ordered = TRUE, conf.level = 0.95)TukeyHSD(aov1, 'Line':'Temp',ordered = TRUE, conf.level = 0.95)TukeyHSD(aov1, 'Line'&'Temp',ordered = TRUE, conf.level = 0.95) 但没有成功。

structure(list(Concentration = structure(c(2L, 7L, 7L, 1L, 7L, 
1L, 2L, 1L, 7L, 1L, 4L, 2L, 2L, 1L, 2L, 4L, 7L, 2L, 2L, 1L), .Label = c("a", 
"b", "c", "d", "e", "x", "y"), class = "factor"), Sex = structure(c(1L, 
2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 
1L, 2L, 1L), .Label = c("f", "m"), class = "factor"), Line = structure(c(3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 3L, 
3L, 3L, 3L), .Label = c("20", "23", "40", "73"), class = "factor"), 
    Temp = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L), .Label = c("23", 
    "29"), class = "factor"), X0.5_sec.sum = c(107.19, 46.17, 
    58.05, 75.87, 87.75, 71.55, 46.17, 47.25, 22.41, 31.05, 27.36, 
    79.11, 87.58, 21.33, 34.29, 60.4, 85.05, 72.47, 114.21, 67.77
    )), .Names = c("Concentration", "Sex", "Line", "Temp", "X0.5_sec.sum"
), row.names = c(NA, 20L), class = "data.frame")

要仅显示变量 LineTemp 之间的相互作用,您可以指定参数 which,如下所示:

which = 'Line:Temp'

然后将对 TukeyHSD 的完整函数调用转换为:

TukeyHSD(aov1, 'Line:Temp', ordered = TRUE, conf.level = 0.95)