#Two occasion estimation stats plot
#There are three columns: x2, a character vector that denotes occasion,
#y2, a numerical vector containing the outcome,
#ID, a numerical vector indicating eachperson's identifier across two rows
#data are long (two rows per case)

library(dabestr)

two.group.paired <- dabest(dabestdat, x2, y2,
idx = c("0.pretest", "1.posttest"),
paired = TRUE, id.col = ID) %>%
mean_diff(ci = 95, reps = 5000, seed = 12345)

two.group.paired
## dabestr (Data Analysis with Bootstrap Estimation in R) v0.3.0
## =============================================================
##
## Good afternoon!
## The current time is 16:40 PM on Tuesday October 13, 2020.
##
## Dataset : dabestdat
## X Variable : x2
## Y Variable : y2
##
## Paired mean difference of 1.posttest (n = 50) minus 0.pretest (n = 50)
## 7.43 [95CI 4.3; 10.5]
##
##
## 5000 bootstrap resamples.
## All confidence intervals are bias-corrected and accelerated.
plot(two.group.paired)