Hi there,
Thanks for making such a great package.
I am just wondering if I’m missing something with the updated version of the package.
I am using estimation statistics to analyse the difference in scores between before and after an intervention for two groups (case and control)
Back in July (using version 0.2.5) I ran a series of multi-paired plots using the below code (adapted from the vignettes helpfully provided on the package page).
library(dplyr)
assign('data',read.csv("data.csv"))
set.seed(54321)
# generate data (note that the data.csv has NA in already as case and control not equal size)
N = 314+284
c1 <- c(data[['control_pre']],rep(NA,284))
c2 <- c(data[['control_post']],rep(NA,284))
c3 = c(rep(NA,284),data[['case_pre']])
c4 = c(rep(NA,284),data[['case_post']])
dummy <- rep("Dummy", N) # make a dummy column
id <- 1:N
wide.data <-
tibble::tibble(
control_pre = c1, control_post = c2, case_pre = c3, case_post = c4,
Dummy = dummy,
ID = id)
my.data <-
wide.data %>%
tidyr::gather(key = Group, value = Measurement, -ID, -Dummy)
library(dabestr)
multi.two.group.paired<-
na.omit(my.data) %>%
dabest(Group, Measurement,
idx = list(c("control_pre", "control_post"),c("case_pre","case_post")),
paired = TRUE, id.col = ID)
plot(multi.two.group.paired)
I returned to the analysis late last year, and updated to version 0.3.0, and I used the following code (again this was adapted from the provided vignettes)
library(dplyr)
assign('data',read.csv("data.csv"))
set.seed(54321)
# generate data (note that the data.csv has NA in already as case and control not equal size)
N = 314+284
c1 <- c(data[['control_pre']],rep(NA,284))
c2 <- c(data[['control_post']],rep(NA,284))
c3 = c(rep(NA,284),data[['case_pre']])
c4 = c(rep(NA,284),data[['case_post']])
dummy <- rep("Dummy", N) # make a dummy column
id <- 1:N
wide.data <-
tibble::tibble(
control_pre = c1, control_post = c2, case_pre = c3, case_post = c4,
Dummy = dummy,
ID = id)
my.data <-
wide.data %>%
tidyr::gather(key = Group, value = Measurement, -ID, -Dummy)
library(dabestr)
multi.two.group.paired<-
na.omit(my.data) %>%
dabest(Group, Measurement,
idx = list(c("control_pre", "control_post"),c("case_pre","case_post")),
paired = TRUE, id.col = ID)
multi.two.group.paired.mean_diff = mean_diff(multi.two.group.paired)
plot(multi.two.group.paired.mean_diff)
However, the results provided very different paired mean difference plots, despite the Tufte slopegraphs being identical. I have verified this more recently by running the above code on the same machine and installing either version 0.2.5 or 0.3.0.
As far as I can see, the only difference in the code is the use of the mean_diff function in the code used for version 0.3.0. Are there any additional arguments I need to provide that would correct for this difference, or am I missing something?
I would be really grateful for any support with this,
Thanks so much,
Best wishes,
Tim