[Mediation-information] Error when using mediate function with lme4 models

Jean-Philippe Laurenceau jlaurenceau at psych.udel.edu
Mon Jan 20 18:44:54 CET 2014


Dear R mediation Folk-I would like to start by saying that I have been enjoying the functionality and flexibility of the mediation package that Kosuke, Dustin, Teppei, Luke, et al. have developed. Bravo and keep up the important work of disseminating this tool!

Nevertheless, I ran into a surprising error just this morning when running mediate on some lme4 data runs. It looks like an issue with the coding rather than my data because I get the same error when running the multilevel modeling example on the "jobs" data from the reference manual. This is what I get:

> model.m <- glmer(job_dich ~ treat + econ_hard + (1 | educ), family = binomial(link = "probit"), data = jobs)
> model.y <- glmer(work1 ~ treat + job_dich + econ_hard + (1 + treat | occp), family = binomial(link = "probit"), data = jobs)
> multilevel <- mediate(model.m, model.y, treat = "treat", mediator = "job_dich", sims=50, group.out="educ")

Error in mvrnorm(sims, mu = MModel.coef, Sigma = MModel.var.cov) :  incompatible arguments

I am still somewhat new to R, so any insights on what needs to be tweaked would be much appreciated.

Best, J-P

Jean-Philippe Laurenceau, Ph.D.
Department of Psychology
University of Delaware
110 Wolf Hall
Newark, DE 19716-2577
Voice: (302) 831-2309
Fax: (302) 831-3645
jlaurenceau at psych.udel.edu<mailto:jlaurenceau at psych.udel.edu>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20140120/214b4fd8/attachment.html>


More information about the Mediation-information mailing list