I have a dataset like the following.
Group <- c("A", "B", "A", "A", "A", "B", "A", "A", "B", "B","A", "A", "B", "B")
Score <- c(26, 22, 15, 5, 19, 3, 4, 5, 23, 3, 5, 2, 20, 4)
Order <- c("First", "First", "First", "Second", "First", "Second", "Second", "Second", "First", "Second", "Second", "Second", "First", "Second")
Data <- data.frame(Group, Score, Order)
Data
Group Score Order
1 A 26 First
2 B 22 First
3 A 15 First
4 A 5 Second
5 A 19 First
6 B 3 Second
7 A 4 Second
8 A 5 Second
9 B 23 First
10 B 3 Second
11 A 5 Second
12 A 2 Second
13 B 20 First
14 B 4 Second
I need to plot the differences in scores between each group, with effect sizes for each comparison (either Cohen's d or Hedge's g would work).
The code below gets me everything I want on the plot, but the effect size.
OrderComparison <- list(c("First", "Second"))
ggplot(Data, aes(Order, Score, fill=Order))+
stat_summary(geom = "bar", fun = mean, position = "dodge", color="black")+
stat_summary(geom = "errorbar", fun.data = mean_se, position = "dodge", width=.2)+
stat_compare_means(method = "t.test", comparisons = OrderComparison, label = "p.signif", position = "identity")+
facet_wrap(~Group, scales="fixed", strip.position = "bottom")+
theme_classic()+
theme(legend.position = "none")+
scale_fill_grey(start = .6, end = 1)
Question
What code (and/or package) do I need to automatically put an effect size on each comparison?
Any advice or guidance is appreciated.