I want to add the significance level of a comparison between 2 independent groups using stat_compare_means()
of the ggpubr package.
When using method = "t.test"
, the function will run a Welch t-test assuming the variances are not equal.
If using base R t.test()
I'd add var.equal=TRUE
, but I couldn't find a way to do so in 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)))
I need the function to run a t-test assuming the variances are equal.