0
$\begingroup$

Doing a straightforward mediation analysis, a => b => c (indirect effect) and a => c (direct effect).

If I do this in mediation::mediate(), I get Estimate 95% CI Lower 95% CI Upper p-value ACME 0.02020 -0.00349 0.04934 0.10 ADE -0.10003 -0.17762 -0.01430 0.02 Total Effect -0.07984 -0.15468 0.00584 0.06 Notice this gives me the direct effect a => c (ADE) and an indirect effect a => b => c (ACME), but does not break out a => b and b => c effects.

In contrast, when I use lavaan, I get lhs op rhs label est se z pvalue ci.lower 1 c ~ a c -0.101 0.041 -2.465 0.014 -0.182 2 b ~ a a 0.260 0.064 4.065 0.000 0.135 3 c ~ b b 0.080 0.045 1.776 0.076 -0.008 4 c ~~ c 0.072 0.007 9.644 0.000 0.058 5 b ~~ b 0.191 0.020 9.644 0.000 0.152 6 a ~~ a 0.250 0.000 NA NA 0.250 7 indirect := a*b indirect 0.021 0.013 1.628 0.104 -0.004 8 direct := c direct -0.101 0.041 -2.465 0.014 -0.182 9 total := c+(a*b) total -0.081 0.040 -2.026 0.043 -0.159

The direct, indirect, and total effects match up very well between packages. However, I'd like to get the path coefficients in mediation::mediate like I do in lavaan. Finding those is my question.

I tried a 2SLS approach, but I don't get the right values. If I do a regression bOnA <- lm( b ~ a ) where a is a binary factor treatment variable and b is a continuous variable, then I get lavaan's coefficient (.26) when I don't standardize anything and include the intercept. I assume that for the 2nd stage I should use b <- predict(bOnA, type="response") and cOnB <- lm( c ~ b ) but I can't seem to get a coefficient from the 2nd stage model cOnB that has a coefficient matching lavaan.

Interestingly, if I divide the mediate() indirect effect by .26, I get .077, which is basically lavaan's output. So it seem that things are correct up to that point.

I've tried variations of the 2nd stage model with centering, standardizing, and removing the intercept to no avail.

My goal is to get this working for a simple case, because I want to use mediate() for more complex models than lavaan can handle.

$\endgroup$

1 Answer 1

0
$\begingroup$

This was a conceptual error on my part. One can obtain the lavaan coefficients using lm with two models: bOnA <- lm ( b ~ a ) cOnAandB <- lm ( c ~ a + b) Notice the difference between cOnAandB and cOnB. The coefficient for b obtained from cOnAandB matches lavaan exactly.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.