Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dof bug issue #106 #107

Merged
merged 1 commit into from
Jun 23, 2021
Merged

dof bug issue #106 #107

merged 1 commit into from
Jun 23, 2021

Conversation

FellowFish
Copy link
Contributor

edited the code in effsize file(effsize boot function) to account for paired and unpaired cases

@josesho josesho changed the base branch from master to v0.3.9999 June 7, 2021 05:49
@josesho
Copy link
Member

josesho commented Jun 7, 2021

Hi @FellowFish ,

Can you include below a copy-pastable example?

e.g.

library(dabestr)

# Performing unpaired (two independent groups) analysis.
unpaired_mean_diff <- dabest(iris, Species, Petal.Width,
                             idx = c("setosa", "versicolor", "virginica"),
                             paired = TRUE)

# Code demonstrating you have fixed the bug goes below.
# 

Thanks!
Joses

@FellowFish
Copy link
Contributor Author

FellowFish commented Jun 11, 2021

Sorry for the late reply. Below is the reproducible code.
Using the data given from issue #106:

d <- structure(list(change = c(-3, -3, 3, 3, -3, -3, 25, 25, -8, -8, 2, 2, 24, 
                               24, 2, 2, 10, 10, 24, 24, 0, 0, 37, 37),
                    Timepoint = c("T1", "T2", "T1", "T2", "T1", "T2", "T1", "T2", 
                                  "T1", "T2", "T1", "T2", "T1", "T2", "T1", "T2", 
                                  "T1", "T2", "T1", "T2", "T1", "T2", "T1", "T2"), 
                    Result = c(35, 32, 81, 84, 69, 66, 82, 107, 84, 76, 108, 110,
                               75, 99, 57, 59, 102, 112, 68, 92, 76, 76, 75, 112), 
                    Id = c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 6L, 7L, 
                           7L, 8L, 8L, 9L, 9L, 10L, 10L, 11L, 11L, 12L, 12L)),
                    row.names = c(NA, -24L), class = c("tbl_df", "tbl", "data.frame"))

d_wide <- structure(list(Id = 1:12, T1 = c(35, 81, 69, 82, 84, 108, 75, 57, 102, 68, 76, 75), 
                         T2 = c(32, 84, 66, 107, 76, 110, 99, 59, 112, 92, 76, 112),
                         change = c(-3, 3, -3, 25, -8, 2, 24, 2, 10, 24, 0, 37)), 
                    row.names = c(NA, -12L), class = c("tbl_df", "tbl", "data.frame"))
dabest.obj <- d %>%
  dabest(Timepoint, Result, 
         idx = c("T1", "T2"), 
         paired = TRUE, id.col = Id)

dabest.obj %>% mean_diff()

Performing Bootstrap we get the confidence interval:

set.seed(12345)
boot.ci(boot(d_wide %>% data.frame, 
             statistic = function(data, indices) 
               return(mean(data[indices, "T2"]) - mean(data[indices, "T1"])), 
             R=10000))

image

Using Dabestr we get the confidence interval, which is quite different from the confidence interval gotten from bootstrapping:

image

With the edit we get, with a much closer confidence interval:
image

The edit takes into account whether the data is paired or not, and computes the bootstrap accordingly.

@josesho
Copy link
Member

josesho commented Jul 26, 2021

Update:

The dev version v0.3.9999 fixes this, and can be installed with

devtools::install_github("ACCLAB/dabestr",  ref = "v0.3.9999")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants