[Mediation-information] problem with replicating causal mediation estimates - treatment and mediator interaction

Benedicte Lescrauwaet Benedicte.Lescrauwaet at UGent.be
Thu Jan 7 14:02:46 CET 2021


Mediation analysis project using data from a randomised controlled trial


Dear Sirs,


For my PhD research, I investigate causal mediation effect using Stata (both medeff and paramed commands).

Because of my specific research question, I will likely need to use different types of statistical models. So, I started working with ‘mediate’ function in R, given its flexibility.


Currently, my project uses a binary mediator, outcome and treatment

Under the No Interaction (NINT) assumption, the results generated with Stata medeff, Stata paramed and R mediate were pretty consistent. (with the exception that paramed generated odd ratios rather than risk difference).

However, when I relaxed the NINT assumption (in my research), the results with Stata commands changed e.g. ADE (treated) decreased from approx. 19 to 6 (and lost significance).

Because I wasn’t sure how to interpret this, my idea was to replicate Stata results in R and vice versa.


Starting with the framing example described in jstatsoft “mediation: R Package for Causal Mediation Analysis” (pg. 7-9), I was able to exactly replicate the estimates under the NINT assumption.

But when introducing treatment and mediator interaction (pg 9), I was not able to replicate the estimates (significant levels were comparable though). In addition, ADE (control) was negative in below output, vs positive in the paper.

I tried different ways, for example setting seed prior to running mediate (this was suggested in one of the previous threads posted).


This may sound like nitpicking. But that is not my intent. My plan is to ensure the causal mediation estimates align (in terms of significance, the direction of effect) regardless of the mediation package. I seem stuck as I am unable to replicate this framing example in R, so makes no sense to compare it with my Stata output.


I assume I made an error, or overlooked anything? Thank you for your help with my “endeavours”.

Benedicte Lescrauwaet

PhD candidate University of Gent Belgium

benedicte.lescrauwaet at ugent.be


OUTPUT

mediation: Causal Mediation Analysis

Version: 4.5.0



> set.seed(2014)

> data("framing", package = "mediation")

/// NINT assumption ///

> med.fit <-lm(emo~ treat + age + educ + gender + income, data = framing)

> out.fit <- glm(cong_mesg ~ emo + treat + age + educ + gender + income, data=framing, family = binomial("probit"))

> med.out <- mediate(med.fit, out.fit, treat = "treat", mediator = "emo", robustSE = TRUE, sims = 100)

> summary(med.out)


Causal Mediation Analysis

Quasi-Bayesian Confidence Intervals

                         Estimate 95% CI Lower 95% CI Upper p-value

ACME (control)             0.0791       0.0351         0.15  <2e-16 ***

ACME (treated)             0.0804       0.0367         0.16  <2e-16 ***

ADE (control)              0.0206      -0.0976         0.12    0.70

ADE (treated)              0.0218      -0.1053         0.12    0.70

Total Effect               0.1009      -0.0497         0.23    0.14

Prop. Mediated (control)   0.6946      -6.3109         3.68    0.14

Prop. Mediated (treated)   0.7118      -5.7936         3.50    0.14

ACME (average)             0.0798       0.0359         0.15  <2e-16 ***

ADE (average)              0.0212      -0.1014         0.12    0.70

Prop. Mediated (average)   0.7032      -6.0523         3.59    0.14

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Sample Size Used: 265

Simulations: 100


/// Relaxing NINT assumption ///

> med.fit <-lm(emo~ treat + age + educ + gender + income, data = framing)

> out.fit <- glm(cong_mesg ~ emo * treat + age + educ + gender + income, data=framing, family = binomial("probit"))

> med.out <- mediate(med.fit, out.fit, treat = "treat", mediator = "emo", robustSE = TRUE, sims = 100)

> summary(med.out)


Causal Mediation Analysis

Quasi-Bayesian Confidence Intervals

                          Estimate 95% CI Lower 95% CI Upper p-value

ACME (control)            0.076168     0.034648         0.13  <2e-16 ***

ACME (treated)            0.099377     0.037170         0.17  <2e-16 ***

ADE (control)            -0.000209    -0.129077         0.10    0.96

ADE (treated)             0.023000    -0.108593         0.15    0.76

Total Effect              0.099168    -0.031926         0.22    0.12

Prop. Mediated (control)  0.648575    -2.341819        11.02    0.12

Prop. Mediated (treated)  0.871007    -3.071536        13.97    0.12

ACME (average)            0.087773     0.038951         0.15  <2e-16 ***

ADE (average)             0.011396    -0.114601         0.11    0.82

Prop. Mediated (average)  0.759791    -2.583546        12.49    0.12

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Sample Size Used: 265

Simulations: 100



/// Relaxing NINT assumption and introducing set.seed prior to mediate///

> med.fit <-lm(emo~ treat + age + educ + gender + income, data = framing)

> out.fit <- glm(cong_mesg ~ emo * treat + age + educ + gender + income, data=framing, family = binomial("probit"))

> set.seed(2014)

> med.out <- mediate(med.fit, out.fit, treat = "treat", mediator = "emo", robustSE = TRUE, sims = 100)

> summary(med.out)


Causal Mediation Analysis

Quasi-Bayesian Confidence Intervals

                          Estimate 95% CI Lower 95% CI Upper p-value

ACME (control)             0.07724      0.02967         0.15  <2e-16 ***

ACME (treated)             0.09698      0.04396         0.18  <2e-16 ***

ADE (control)             -0.00785     -0.11271         0.10    0.84

ADE (treated)              0.01189     -0.10190         0.16    0.90

Total Effect               0.08913     -0.03616         0.21    0.28

Prop. Mediated (control)   0.66249     -8.39598         6.99    0.28

Prop. Mediated (treated)   0.86221    -11.28999         7.74    0.28

ACME (average)             0.08711      0.03747         0.17  <2e-16 ***

ADE (average)              0.00202     -0.10271         0.13    0.98

Prop. Mediated (average)   0.76235    -10.18858         7.36    0.28

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Sample Size Used: 265

Simulations: 100

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20210107/77a9a17f/attachment-0001.html>


More information about the Mediation-information mailing list