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

Multi-paired analysis with unequal samples #36

Closed
araikes opened this issue Jun 21, 2019 · 3 comments
Closed

Multi-paired analysis with unequal samples #36

araikes opened this issue Jun 21, 2019 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@araikes
Copy link

araikes commented Jun 21, 2019

Greetings,
I'm hoping you can help me. I'm looking to analyze some data from a repeated measures ANOVA design (2 groups, pre- and post-measures). Unfortunately there is some missing data and so currently my sample sizes are unbalanced (n=12 and n=15).

I can use dabestr to analyze the groups separately using a paired analysis. However, if I try to use the multi-group paired method, I get an error. Any advice or help would be great.

See below for reproducible example

Data

library(tidyverse)
library(dabestr)

demo_data <- data.frame(id = rep(seq(1:27), each = 2),
                        group = rep(c("amber", "blue"), 
                                    times = c(15, 12)),
                        phase = rep(c("baseline", "ptx"),
                                    times = 27, each = 1),
                        score = rnorm(54, mean = 10, sd = 2))

Single group analyses:

demo_data %>%
  filter(group == "blue") %>%
  dabest(phase, score,
         idx = list(c("baseline", "ptx")),
         paired = TRUE,
         id.col = id)

DABEST (Data Analysis with Bootstrap Estimation) v0.2.0

Variable: score

Paired mean difference of ptx (n=12) minus baseline (n=12)
0.255 [95CI -1.61; 1.85]

5000 bootstrap resamples.
All confidence intervals are bias-corrected and accelerated.

demo_data %>%
  filter(group == "amber") %>%
  dabest(phase, score,
         idx = list(c("baseline", "ptx")),
         paired = TRUE,
         id.col = id)

DABEST (Data Analysis with Bootstrap Estimation) v0.2.0

Variable: score

Paired mean difference of ptx (n=15) minus baseline (n=15)
-0.719 [95CI -2.12; 0.619]

5000 bootstrap resamples.
All confidence intervals are bias-corrected and accelerated.

However, it fails if I try to run both groups together:

# Merge group and phase for a single column

demo_data %>%
  unite(group, c("group", "phase"), sep = "_") %>%
  dabest(group, score,
         idx = list(c("blue_baseline", "blue_ptx"),
                    c("amber_baseline", "amber_ptx")),
         paired = TRUE,
         id.col = id)

demo_data %>%
  unite(group, c("group", "phase"), sep = "_") %>%
  group_by(group) %>%
  summarise(count = n())

Error in dabest(., group, score, idx = list(c("blue_baseline", "blue_ptx"), :
The two groups are not the same size, but paired = TRUE.

A tibble: 4 x 2
group count

1 amber_baseline 15
2 amber_ptx 15
3 blue_baseline 12
4 blue_ptx 12

@josesho josesho added the help wanted Extra attention is needed label Jun 23, 2019
@josesho josesho self-assigned this Jun 23, 2019
@araikes
Copy link
Author

araikes commented Jul 1, 2019

I don't know what the difference is today but it worked without issue on my actual data.

I will continue to test and play

@josesho
Copy link
Member

josesho commented Jul 2, 2019

OK, just re-open if this issue comes up again.

@benjaminwnelson
Copy link

I'm having the same issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants