r - ggpubr (stat_compare_means) 中是否有一种方法可以在假设方差相等的情况下运行测试比较(而不是 R 默认 Welch 的 t 检验)
问题描述
我想使用stat_compare_means()
ggpubr 包添加两个独立组之间比较的显着性水平。
使用 时method = "t.test"
,假设方差不相等,该函数将运行 Welch t 检验。
如果使用 base Rt.test()
我会添加var.equal=TRUE
,但我在 ggpubr 中找不到这样做的方法?
ggstripchart(dat, x = "Group", error.plot = "errorbar", # Add error bars
with SD
y = "tcm_cd4", combine = TRUE, color = "Group", size = 7, # Size of
# shapes.
shape = "Group", # Change shape according to Group
add = c("mean_sd", "mean"),
jitter = 0.2, add.params = list(size = 1.4, color = "darkblue"),
font.label = list(size = 14, face = "bold")) +
stat_compare_means(method = "t.test", label = "p.format",
bracket.size = 1,
tip.length = 0,
comparisons=list(c(1,2), c(1,3), c(2,3)))
假设方差相等,我需要该函数来运行 t 检验。
解决方案
没有数据很难回答,但你试过这个method.args =
论点吗?
+ stat_compare_means(method = "t.test",
method.args = list(var.equal = TRUE),
label = "p.format",
bracket.size = 1,
tip.length = 0,
comparisons=list(c(1,2), c(1,3), c(2,3)))
推荐阅读
- flutter - 当您按下/按住按钮之类的东西时,元素后面的颤动背景
- javascript - Vue,SVG,mousehover 之后,mouseleave 立即发生在 SVG rect 之后
- javascript - 如何为数据库连接以及查询编写 mocha/chai 测试?
- c++ - 在 C++ Builder 中使用 NULL 构造 DynamicArray
- vim - 在 (Neo)vim 中突出显示光标词
- r - 如何使用 dplyr 将矩阵列转换为单独的列?
- python - 如何使用 numpy memmap 将 numpy 数组完全放在 RAM 上?
- ansible - 使用多个 and and or 选项运行 ansible playbook
- ruby-on-rails - 来自 wiki 的 Rails Devise 文章抛出错误:未定义的局部变量或方法 `authenticated_user_root_path'
- autohotkey - Autohotkey:如何将撇号 (") 添加到字符串