[Mediation-information] moderated mediation analysis using 'mediation' package

Liviu Andronic landronimirc at gmail.com
Thu Mar 22 18:17:05 CET 2012


Dear Teppei


On Thu, Mar 22, 2012 at 5:34 PM, Teppei Yamamoto <teppei at mit.edu> wrote:
> Moderated mediation is supported in the mediation package as of the most
> recent update (4.0), which we were about to announce to the list
>
Very timely update, indeed. :) Thank you so much.


> subscribers. Your code looks correct except the last step, where you need to
> use the "covariates" argument and specify the value of the moderator on
> which the estimate will be conditioned.
>
I tried this and I'm slightly surprised that one needs to use fixed
values for the moderator. For example, the following ends in an error:
> med_b <- mediate(mod.m2, mod.y2, dropobs=F, treat='EVPUBLIC', mediator='TRUST', covariates=list(ENGAGESP),  boot=T, sims=50)
Error: object 'ENGAGESP' not found

while this version succeeds:
> med_b <- mediate(mod.m2, mod.y2, dropobs=F, treat='EVPUBLIC', mediator='TRUST', covariates=list(ENGAGESP=0.5),  boot=T, sims=50)

I was given to understand that one may use a variable in its entirety
(as a moderator) instead of using only 'specific values of the
pre-treatment covariates'. Perhaps we are not talking of the same
procedure?

Regards
Liviu


More information about the Mediation-information mailing list