When performing post-hoc simple slope analysis on my linear mixed effect model in R using emtrends(), I noticed that pairwise slope comparisons showed differences in the significance when I tested all slopes against 0 compared to when testing against 1 in the same function.
Details: I have a mixed effect model with a significant interaction baseline * condition. Outcome and baseline are continuous, condition is a factor with 3 levels: 0, 1, 2.
mod<-lmer(outcome~condition*baseline+(1|subject))
When investigating the slopes with emtrends() more closely I find that all trends/conditions are significantly different from 0 - the default null (trds$emtrends).
trds0<-emtrends(mod, pairwise ~ condition, var = "baseline", infer=TRUE) # or
trds0<-emtrends(mod, pairwise ~ condition, var = "baseline") |> test(null=0)
Cond=condition, CovBLCen =baseline
In trds0$contrasts, pairwise comparison of the conditions show that 0-1 and 0-2 differ significantly but 1-2 is not significant.
Then, I tested the trends against 1 because it is a better reference for my model, results are as expected, conditions 1 and 2 differ from 0 whereas condition 0 is not significant.
trds1<-emtrends(mod, pairwise ~ condition, var = "baseline") |> test(null=1)
Cond=condition, CovBLCen =baseline
Unexpectedly, I found that the pairwise comparisons (trds1$contrasts) are now all significant with different p-values.
In my understanding, the function estimates slopes for each condition and compares against the null if specified in the first part of the output. In an additional step, since I added pairwise comparisons, pairs of slopes in relation to one another are tested for their significance, which should not be affected by the overall t-test performed on all slopes in the first step.
I would be very grateful to hear about any possible reasons why this is statistically sound, or more insights into the function itself. I found only limited material on the functioning of pairwise within emtrends/emmeans. I have not provided data or full code since my code is running without issue, I'm merely struggling to interpret the output. Many thanks!