在使用Bonferroni的程序时,我在寻找LSD的值时遇到了一个问题。它返回NULL,你能帮我解决这个问题吗?非常感谢。
library(agricolae)
# Input the treatments and responses
trt <- c(rep("P", 4), rep("T", 4), rep("S", 4), rep("E", 4), rep("C",4))
response <- c(29.6, 24.3, 28.5, 32, 27.3, 32.6, 30.8, 34.8, 5.8, 6.2, 11, 8.3,
21.6, 17.4, 18.3, 19, 29.2, 32.8, 25, 24.2)
trt <- as.factor(trt)
df <- data.frame(trt, response)
model <- aov(response ~ trt, data = df)
out <- LSD.test(model, "trt", p.adj = "bonferroni")
out
# Obtain the LSD value
out$statistics$LSD

发布于 2020-09-24 16:44:39
不幸的是,它并没有很好的文档记录。您可以检查code for LSD.test,然后您就拥有了:
if (length(nr) == 1 & p.adj == "none")
statistics <- data.frame(statistics, t.value = Tprob,
LSD = LSD)
if (length(nr) == 1 & p.adj != "none")
statistics <- data.frame(statistics, t.value = Tprob,
MSD = LSD)因此,当您的p.adjust不是"none"时,它会将列名改为MSD,这意味着最小的显著差异。您也可以切换到控制台(选项console =TRUE)来查看这一点。
https://stackoverflow.com/questions/64037263
复制相似问题