Skip to main content
1 of 3
Sointu
  • 2.8k
  • 5
  • 13

Regarding both pairwise comparisons and adjustment for multiple testing, doesn't emmeans solution work?

library(emmeans)
em1<-emmeans(m2, ~cyl)
em1
contrast(em1, "pairwise", simple="each", combine=T, adjust="tukey") #this gives you all pairwise comparisons with tukey's multiple comparison adjustment, you can also choose other adjustments such as bonferroni but tukey's is probably most commonly used

Re:

From the table above, the p-value of $βcyl=6$ is 0.036<0.05 Could I interpret this value directly and conclude: "The mean disp with cyl=6 is different from that with cyl=4 (baseline) after controlling drat"

Yes, but that's the p-value before adjustments. This comparison is actually no longer significant after applying tukey's correction.

Sointu
  • 2.8k
  • 5
  • 13