r - 在 R 中使用 Bonferroni 程序时,LSD 值为空
问题描述
使用 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
解决方案
不幸的是,它没有很好的记录。你可以检查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
意味着最小显着差异。您也可以切换到控制台(选项控制台 =TRUE)来查看。
推荐阅读
- angular - 简单计算的打字稿“不舍入”数字
- c# - Visual Studio的clickonce更新不起作用
- android - 本地化 - 在 Android 应用程序中执行本地化时,只有少数字符串会转换为印地语
- c++ - 通过指向 base、static_cast、crtp、删除模板的指针派生的成员
- python - Pandas 为单元格赋值,为什么这不起作用?
- javascript - 如果我在非异步函数中不等待就调用“AsyncStorage.setItem”会发生什么?
- .htaccess - Htaccess - 主页的 If/esle 语句语法
- php - 使用 jquery 的编辑按钮在下一页上不起作用无法编辑我的数据
- facebook - 创建二维码直接进入 Facebook 发帖
- arrays - 当它是另一个数组的元素时,如何约束数组的元素类型