1

我想使用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 检验。

4

1 回答 1

2

没有数据很难回答,但你试过这个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)))
于 2019-05-15T00:08:47.437 回答