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

Difficulty plotting based on levels #91

Closed
sophschwartz opened this issue Aug 7, 2020 · 1 comment
Closed

Difficulty plotting based on levels #91

sophschwartz opened this issue Aug 7, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@sophschwartz
Copy link

Error in levels<-(*tmp*, value = as.character(levels)) :
factor level [4] is duplicated

Dataframe:
Z-Score_Alpha_Right_Temporal_GroupbyMeasurement.xlsx

Code:
Z_Score_Alpha_Right_Temporal <- read_excel("(https://github.com/ACCLAB/dabestr/files/5042212/Z-Score_Alpha_Right_Temporal_GroupbyMeasurement.xlsx")
multi.two.group.unpaired <-
Z_Score_Alpha_Right_Temporal %>%
dabest(Group, Measurement,
idx = list(c("ASDV", "TD"),
c("ASDMLV", "TD"),
c("ASDMLV", "ASDV")),
paired = FALSE)
multi.two.group.unpaired.meandiff <- mean_diff(multi.two.group.unpaired)
plot(multi.two.group.unpaired.meandiff, color.column = Group)

The group appears to have 3 levels based on:
multi.two.group.unpaired.meandiff[[1]]$Group <- factor(multi.two.group.unpaired.meandiff[[1]]$Group, levels = unique(multi.two.group.unpaired.meandiff[[1]]$Group), ordered=FALSE)

@josesho josesho added the help wanted Extra attention is needed label Aug 8, 2020
@josesho
Copy link
Member

josesho commented Aug 8, 2020

Hi @sophschwartz ,

The error arises because you have repeated groups in your idx, as seen in your example:

idx = list(c("ASDV", "TD"),
              c("ASDMLV", "TD"),
              c("ASDMLV", "ASDV"))

From the earliest stages of designing dabestr, we decided not to allow plotting of the same group twice—both an aesthetic decision and a statistical one: we don't want viewers (and the plotters themselves) to unintentionally perceive the two instances of ASDMLV, for instance in this case.

The UI/UX, however, can be improved: when loading the data into dabestr, and when calling the mean_diff function. (In fact, the effect size functions do allow computation of the effect sizes!!)

On a broader and related topic: there have been several requests (here, here, and here) to perform ANOVA in DABEST: comparing all groups to all other groups. What we consider best practice is to use delta-delta plots. These are still being developed, unfortunately.

You can use estimationstats.com to produce the plot you desire as well, but the second appearance of a repeated group will be colored differently (and given an additional prefix): you can fix this in any vector graphics software.

Hope this helps!
Joses

@josesho josesho closed this as completed Feb 7, 2021
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

2 participants