我想使用ggpubr软件包的stat_compare_means()
添加2个独立组之间比较的显着性水平。
使用method = "t.test"
时,该函数将在假设方差不相等的情况下运行Welch t检验。
如果使用基数R t.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检验的函数。
答案 0 :(得分:0)
在没有数据的情况下很难回答,但是您是否尝试过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)))