Read data
d<-read.csv("Fig2B_Data.csv")
head(d)
## nr ant slope date BodyMass ssm
## 1 185 Formica 0 12.09.2012 15.6 -2.01015529
## 2 196 Formica 0 13.09.2012 15.8 -1.34545770
## 3 207 Formica 0 14.09.2012 23.2 -0.81820922
## 4 225 Formica 0 17.09.2012 21.6 -2.46139868
## 5 611 Cataglyphis 0 29.10.2012 30.0 -0.01704418
## 6 621 Cataglyphis 0 29.10.2012 28.0 -1.27103576
Bootstrapping with dabestr
# group data for Multi-two group comparisons
d$Group <- NaN
d$Group[which(d$ant=="Formica" & d$slope==0)] <- "ControlF"
d$Group[which(d$ant=="Formica" & d$slope==60)] <- "UpslopeF"
d$Group[which(d$ant=="Cataglyphis" & d$slope==0)] <- "ControlC"
d$Group[which(d$ant=="Cataglyphis" & d$slope==60)] <- "UpslopeC"
head(d)
## nr ant slope date BodyMass ssm Group
## 1 185 Formica 0 12.09.2012 15.6 -2.01015529 ControlF
## 2 196 Formica 0 13.09.2012 15.8 -1.34545770 ControlF
## 3 207 Formica 0 14.09.2012 23.2 -0.81820922 ControlF
## 4 225 Formica 0 17.09.2012 21.6 -2.46139868 ControlF
## 5 611 Cataglyphis 0 29.10.2012 30.0 -0.01704418 ControlC
## 6 621 Cataglyphis 0 29.10.2012 28.0 -1.27103576 ControlC
library(dabestr)
## Warning: package 'dabestr' was built under R version 4.0.4
## Loading required package: magrittr
## Warning: replacing previous import 'vctrs::data_frame' by 'tibble::data_frame'
## when loading 'dplyr'
# unpaired Multi-two group analysis
# https://cran.r-project.org/web/packages/dabestr/vignettes/using-dabestr.html
d_dabestr <- dabest(d, Group, ssm,
idx = list(c("ControlC","UpslopeC"),
c("ControlF","UpslopeF")),
paired = FALSE)
d_dabestr
## dabestr (Data Analysis with Bootstrap Estimation in R) v0.3.0
## =============================================================
##
## Good evening!
## The current time is 21:58 on Montag Juli 26, 2021.
##
## Dataset : d
## The first five rows are:
## nr ant slope date BodyMass ssm Group
## 1 185 Formica 0 12.09.2012 15.6 -2.01015529 ControlF
## 2 196 Formica 0 13.09.2012 15.8 -1.34545770 ControlF
## 3 207 Formica 0 14.09.2012 23.2 -0.81820922 ControlF
## 4 225 Formica 0 17.09.2012 21.6 -2.46139868 ControlF
## 5 611 Cataglyphis 0 29.10.2012 30.0 -0.01704418 ControlC
##
## X Variable : Group
## Y Variable : ssm
##
## Effect sizes(s) will be computed for:
## 1. UpslopeC minus ControlC
## 2. UpslopeF minus ControlF
d_diff<-median_diff(d_dabestr,reps=5000)
plot(d_diff,rawplot.ylim=c(-3.2,2),effsize.ylim=c(-2,3.2),float.contrast = F)

Optional: Boxplot + Wilcox.test
library('ggplot2')
library('ggpubr')
ggplot(d,aes(x=as.factor(slope),y=ssm))+
geom_jitter(alpha=0.5,width=0.2)+
geom_boxplot(alpha=0.5)+
facet_grid(.~ant)+
geom_text(aes(label=paste("n=",..count..,sep="")),
y=-4.3,
stat='count',
size=4)+
stat_compare_means(comparisons = list(c("0", "60")),
aes(label = ..p.signif..),
paired=FALSE,
method = "wilcox.test",
method.args = list(alternative="less"),
p.adjust.methods="bonferroni"
)+
stat_summary(fun = median,
geom = "label",
size = 4,
hjust = -0.6,
# alpha=0.8,
aes(label=gsub("\\.",".",as.character(round(..y..,1)))))+
theme_bw()+
ylab("SSM(60) (mm)")+
xlab("Kinematics")
## Warning: Using `as.character()` on a quosure is deprecated as of rlang 0.3.0.
## Please use `as_label()` or `as_name()` instead.
## This warning is displayed once per session.
