0
$\begingroup$

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) 

output trds0

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)

output trds1

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!

$\endgroup$
2
  • $\begingroup$ I don't know how emmeans works in this case but could it be that with your trds1 code the contrast part is now actually testing whether the difference between slopes differs from 1? $\endgroup$
    – Sointu
    Commented Aug 30, 2023 at 8:15
  • $\begingroup$ You are testing different null hypotheses (H_0: slope1-slope2 = 0, then later H_0: slope1-slope2 = 1), so of course the results are different. In this example you can actually compute these tests manually, i.e. in the 2nd case, t = (0.452 - 1)/0.112 = -4.9, as shown. $\endgroup$
    – Russ Lenth
    Commented Sep 5, 2023 at 21:14

0

Your Answer

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