I have conducted a basic mediation analysis using mediation::mediate. My treatment variable (X) is a binary variable with two groups. My mediator and outcome variables are continuous. I also have a random effect to account for repeated measures.

fm2 <- lme4::lmer(mediator ~ treatment + (1|subjectID), data = df)
fm2 <- lme4::lmer(outcome ~ treatment + mediator + (1|subjectID), data = df)
results <- mediation::mediate(fm2, fm3, treat = "treatment", mediator = "mediator")

The results seem to be what I would expect, but I notice that the ACME, ADE and proportion mediated are repeated and identical for both the control and treated group, and the 'average' is therefore just that same number.

enter image description here

Since the treatment variable only has two groups, are the values for each group just showing the effect of treated vs. control and control vs. treated? In which case identical values make sense and are fine? Or is there something I have missed?

All other examples I have seen online either have different values for control and treated groups, OR the summary output simply shows one line for each of ACME, ADE and prop. mediated, such as the image below.

I have tried various things, e.g. including 'control.value = "Control", treat.value = "Treatment", with no luck.

enter image description here

I have also tried to generate a reproducible example below, if needed, and the summary looks the same (the mediation effects are not significant, but my query is only regarding the format of the output).

outcome <- rnorm(98, mean = 10, sd = 2)
mediator <- rnorm(98, mean = 8, sd = 2)
treatment <- rep(c("Control", "Treated"), times = 49)
subjectID <- rep(1:49, times = 2)
df <- data.frame(treatment, mediator, outcome, subjectID)

fm2 <- lme4::lmer(mediator~treatment + (1|subjectID), data = df)

fm3 <- lme4::lmer(outcome~treatment + mediator + (1|subjectID), data = df)

results <- mediation::mediate(fm2, fm3, treat = "treatment", mediator = "mediator")

I'm just curious if I can safely interpret the output, or if the duplication means I may have missed something.

Thank you in advance! Appreciate the help.


1 Answer 1


The values are the same because you don't allow the mediation effects to vary by the treatment. You are using linear models with no treatment-mediator interaction. Generally, this should produce output that doesn't split the mediation effects by treatment group, but there might be a bug in mediation that makes it do this. A quick glance at the source code didn't reveal such a bug, but it may be more nuanced than I can see. If you want to impose the (unnecessarily) strict criterion that the treatment doesn't interact with the mediator, then you can just report the average. Otherwise, I would recommend using a richer and more flexible model that allows for the possibility of such an interaction.

  • $\begingroup$ Thank you! I initially tested for a treatment-mediator interaction and didn't find one, which is why I didn't include an interaction term in fm3. However, now that I have re-run the mediation analysis with the interaction term just to see, the ACME/indirect effect is only significant in the treated group. I presume this is showing moderated mediation, i.e. that the mediator mediates the effect in the treated group, but not in the control group.? Is it still justified to include the interaction term and infer moderated mediation, even when it was not significant to begin with? $\endgroup$
    – Jade
    Commented Aug 16, 2023 at 5:05
  • $\begingroup$ To correct my comment above, I don't think it would technically be moderated mediation, as it isn't a separate covariate that is moderating the effect of either the treatment or moderator. That said, I think the interpretation (that the mediation effect is present in the treated group but not the control group) still stands. $\endgroup$
    – Jade
    Commented Aug 16, 2023 at 5:54

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.