I've performed a two-way ANOVA with two categorical variables that each have two levels (treatment vs. control and genotype 1 vs. genotype 2). I'm interested in whether or not genotype has a significant effect on response to treatment, so I want to test for an interaction. My initial test for interaction is significant:

model <- lm(y ~ genotype + treatment + genotype:treatment, data = df)

                   Df Sum Sq Mean Sq F value   Pr(>F)    
genotype            1   3.53    3.53   6.068   0.0299 *  
treatment           1  50.58   50.58  86.850 7.63e-07 ***
genotype:treatment  1   2.86    2.86   4.903   0.0469 *  
Residuals          12   6.99    0.58                     

In terms of reporting, I would like to estimate the difference in treatment response due to genotype, but I am not sure how to frame this in terms of post-hoc testing. I.e., I want to estimate the difference of differences between (treatment - control)[genotype 1] vs. (treatment - control)[genotype 2] with confidence intervals and controlling for error rate. If I perform a Tukey HSD test, I get the pairwise differences:


  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = lm)

                 diff       lwr        upr     p adj
wt-ko -0.9398734 -1.771217 -0.1085296 0.0298603

           diff      lwr      upr p adj
ctrl-treat 3.555875 2.724531 4.387218 8e-07

                              diff       lwr        upr     p adj
wt:treat-ko:treat  -1.78476896 -3.386802 -0.1827359 0.0277338
ko:ctrl-ko:treat    2.71097908  1.108946  4.3130121 0.0014610
wt:ctrl-ko:treat    2.61600122  1.013968  4.2180343 0.0019526
ko:ctrl-wt:treat    4.49574804  2.893715  6.0977811 0.0000129
wt:ctrl-wt:treat    4.40077019  2.798737  6.0028032 0.0000160
wt:ctrl-ko:ctrl    -0.09497786 -1.697011  1.5070552 0.9979518

But I believe I now want to estimate the value of wt:ctrl-wt:treat vs. ko:ctrl-ko:treat with an appropriate confidence interval (wanting to test if the difference is non-zero). Is there a way to supply a contrast to look at such a difference, or is this a separate analysis/test? And/or is this an appropriate analysis to pursue, or is the fact that the interaction term is significant the answer to my question (treatment effect depends on genotype), and does my attempt to associate this with an effect size (difference of differences) misunderstand the framework?



1 Answer 1


I think I've figured this out by referring to this thread:

compare differences between conditions with emmeans.

Using the emmeans package:

contrast(emmeans(model, ~genotype*treatment), interaction = "consec")

genotype_consec treatment_consec estimate    SE df t.ratio p.value
wt - ko    ctrl - treat             1.69 0.763 12 2.214   0.0469 

This gives the estimate I expect (the difference of differences for the estimated means). I note that the p-value here is the same p-value for the interaction term in the ANOVA table, so I think these tests may be equivalent.


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.