2
$\begingroup$

I conducted a one way anova followed by a tukey-test in Rstudio and used a compact letter display to add letters of significance to a ggplot.

After a positive Grubbs-outlier-test I removed an outlier from the dataframe and ran the tests again. I saw that the Treatments LFs and LK still share the Tukey-letter "b" although their plots don´t overlap anymore.

Is this a possible outcome or did I make a mistake in the process?

#prepare Dataset
SampleName <- c("LK", "LK", "LK", "LK", "LK",
                "LFf", "LFf", "LFf", "LFf", "LFf",
                "LFa",  "LFa",  "LFa",  "LFa",  "LFa",
                "LFs", "LFs", "LFs", "LFs",
                "LZ", "LZ", "LZ", "LZ", "LZ")

CO2Differences_outlier <- c(LK1_diff, LK2_diff, LK3_diff, 
      LK4_diff, LK5_diff, LFf1_diff, LFf2_diff, LFf3_diff, 
      LFf4_diff, LFf5_diff, LFa1_diff, LFa2_diff, LFa3_diff, 
      LFa4_diff, LFa5_diff, LFs1_diff, LFs2_diff, LFs3_diff, 
      LFs5_diff, LZ1_diff, LZ2_diff, LZ3_diff, LZ4_diff, LZ5_diff)

CO2_outlier <- data.frame(SampleName, 
                            CO2Differences_outlier,
                            stringsAsFactors = TRUE)

#run analysis and create compact letter display
anovaCO2 <- aov(CO2_outlier$CO2Differences ~ 
    CO2_outlier$SampleName, data = CO2_outlier)
summary(anovaCO2)
tukeyCO2 <- TukeyHSD(anovaCO2)

cldCO2 <- multcompLetters4(anovaCO2, tukeyCO2)
cldCO2 <- as.data.frame.list(cldCO2$`CO2_outlier$SampleName`)

df_Letters <- data.frame(SampleName=rownames(cldCO2), 
                         TukeyLetters = cldCO2$Letters)

#create plot
ggplot(CO2_outlier, aes(x=SampleName, y=CO2Differences_outlier)) +
  geom_boxplot() +
  stat_summary(fun.y=mean, geom="point", shape=9, size=2) +
  geom_dotplot(binaxis='y', stackdir='center', dotsize=0.5) +
  geom_text(data=df_Letters,
            aes(x=SampleName ,label = TukeyLetters, y=16, 
                hjust=-1)) +
  labs(x = "Treatment", y = "CO2 produced [mg]")

[1]: https://i.sstatic.net/UlJi3.png

$\endgroup$
4
  • $\begingroup$ Regardless of whether your results are correct or not, It is inappropriate to call distributions "statistically equal" just because a certain test cannot distinguish them significantly. They can still be different, and tests may even exist that find them significantly different. $\endgroup$ Commented Feb 20, 2023 at 11:54
  • $\begingroup$ Would you mind either changing the title to "non overlapping" or hyphenating "not overlapping" to "not-overlapping" (or both changes together), because otherwise it seems like "not" goes with "can" ... i.e. "cannot overlapping boxplots share the same letter" which would mean essentially the opposite situation with the boxplots (that you're asking about what happens when they do overlap) $\endgroup$
    – Glen_b
    Commented Feb 21, 2023 at 4:54
  • 2
    $\begingroup$ Seems bizarre to me to couple an ANOVA with a display that doesn't even show means. I wouldn't support removal of that supposed outlier. It only looks odd because the rest of its distribution looks odd. In the context of the data as a whole, it looks as if it should be included. $\endgroup$
    – Nick Cox
    Commented Feb 21, 2023 at 11:54
  • 2
    $\begingroup$ I'm not sure what exactly a "tukey-test in Rstudio" might be, but if it's anything like Tukey's HSD (which seems to be what the code uses), it's hard to see how it relates to overlap (or lack thereof) among the boxplots. That test compares differences of arithmetic means to expected ranges of Normally-distributed variables. $\endgroup$
    – whuber
    Commented Feb 21, 2023 at 12:33

1 Answer 1

1
$\begingroup$

The simple answer is that Tukey's HSD isn't a test of overlapping plots. If it were, we would just look at the plots and not worry about conducting the HSD test.

Note also that LFa and LK have overlapping data, and different Tukey letter assignments, if I understand how you are using "overlapping".

A potential complication, or explanation, may lie in the fact that Tukey HSD has an assumption of homoscedasticity across groups. The heteroscedasticity in your groups may be causing some the unexpected results you are seeing.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.