[Mediation-information] Error message for models fitted with lmer: Mediator model not yet implemented?

Kentaro Hirose hirose1981 at gmail.com
Mon Aug 15 19:46:41 CEST 2016


Hi Hause,

The error message "mediator model is not yet implemented" appears when the
lmer model is not estimated properly. Can you check if (1)
inherits(mediatorModel, "merMod") returns TRUE and (2)
getCall(mediatorModel)[[1]] returns lmer?

It might be also helpful to compare your model with the following toy
example as a way to figure out the problem (e.g., data, code, etc):

-----------------------
library(mediation)
library(lme4)

mediatorModel <- lmer(depress1 ~ treat + age + (1|job_disc), data = jobs)
outcomeModel <- lmer(econ_hard ~ depress1 + treat + age + (1|job_disc),
data = jobs)

mediation <- mediate(model.m = mediatorModel, model.y = outcomeModel, sims
= 100, robustSE = F, treat = "treat", mediator = "depress1")
summary(mediation)
-----------------------

Best,
Kentaro




2016-08-16 1:53 GMT+09:00 Hause Lin <hause.lin at mail.utoronto.ca>:

> Hi,
>
> I've previously used this package to fit simple linear models and it
> worked very well. But recently I've been trying to do this with multilevel
> models (lmer) and I'm getting this message:
>
> Error in mediation::mediate(model.m = mediatorModel, model.y =
> outcomeModel,  :
>   mediator model is not yet implemented
>
> Below are my models. Can anyone tell why I'm getting that error message?
>
> mediatorModel <- lmer(m ~ x1 + x2 + (1 | id), data = df)
>
> outcomeModel <- lmer(y ~ m + x1 + x2 + (1 | id), data = df)
>
> mediation <- mediate(model.m = mediatorModel, model.y = outcomeModel, sims
> = 100, robustSE = F, treat = "x2", mediator = "m")
>
> I really appreciate any help anyone can provide. Thanks!
>
> Best,
> Hause
>
>
> _______________________________________________
> Mediation-information mailing list
> Mediation-information at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/
> listinfo/mediation-information
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20160816/c88cc742/attachment.html>


More information about the Mediation-information mailing list