1

我有一个重要的交互,并想对其进行 Tukey 的 HSD 测试,但是,我在网上找到的示例似乎对我不起作用。

我的数据:

>dput(head(dataAvgSucCI))
structure(list(Collection = c(1L, 1L, 1L, 1L, 1L, 2L), Irrigation = 
structure(c(1L,2L, 3L, 4L, 5L, 1L), .Label = c("Rate1", "Rate2", "Rate3", "Rate4", 
"Rate5"), class = "factor"), meanSuc = c(0.585416666666667, 0.5032, 
0.61375, 0.602775, 0.688466666666667, 0.545133333333333), ab = 
structure(c(1L, 3L, 5L, 7L, 9L, 2L), .Label = c("1.Rate1", "2.Rate1", "1.Rate2", 
"2.Rate2", "1.Rate3", "2.Rate3", "1.Rate4", "2.Rate4", "1.Rate5", 
"2.Rate5"), class = "factor")), row.names = c(NA, -6L), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"), vars = "Collection", drop = TRUE, indices 
= list(0:4, 5L), group_sizes = c(5L, 1L), biggest_group_size = 5L, labels = 
structure(list(Collection = 1:2), row.names = c(NA, -2L), class = "data.frame", 
vars = "Collection", drop = TRUE)

我正在尝试做的事情:

require(multcomp) 
intSucCI <- with(dataAvgSucCI, interaction(Collection, Irrigation)) 
sucCIHSD.aov <- aov(meanSuc ~ Collection*Irrigation, data=dataAvgSucCI) 
summary(sucCIHSD.aov) 
sucCIHSD.glht <- glht(sucCIHSD.aov, linfct = mcp(intSucCI = "Tukey"))

错误代码,出现在前面代码的最后一行:

mcp2matrix 中的错误(模型,linfct = linfct):变量“intSucCI”已在“linfct”中指定,但在“模型”中找不到!

任何帮助将非常感激。谢谢!

4

1 回答 1

0

你知道图书馆 TukeyC 吗?

library(TukeyC)
data(FE)

dad = FE$dfm

mod = aov(y ~ blk + N*P*K, dad)

#Studing K within N0 and P0.
tk = TukeyC(mod, which = 'N:P:K', fl1 = 1, fl2 = 1)
summary(tk)
plot(tk)

See help(TukeyC) to more details!




于 2019-06-17T21:53:07.203 回答