[Mediation-information] Problems with 2-2-1 mediation model

Shivraj Kanungo kanungo at gwu.edu
Wed Sep 28 03:48:49 CEST 2016


Here is my setup for a 2-2-1 multilevel mediation model

# =========================================================================
# 2-2-1 mediation
# =========================================================================
med.fit <- lm(GP.g ~ MF.g +        TE.g + size,           data = dat_simple)
out.fit <- lmer(IP ~ MF.g + GP.g + TE.g + size + (1|gId), data = dat_simple)
med.out <- mediate(med.fit, out.fit, treat = "MF.g", mediator = "GP.g",
                   control.value = 3, treat.value = 4, sims = 100)
summary(med.out)


and here is the output (I searched the web and could not find this error)

> med.fit <- lm(GP.g ~ MF.g +        TE.g + size,           data =
dat_simple)
> out.fit <- lmer(IP ~ MF.g + GP.g + TE.g + size + sex + (1|gId), data =
dat_simple)
> med.out <- mediate(med.fit, out.fit, treat = "MF.g", mediator = "GP.g",
+                    sims = 100)
Error in mediate(med.fit, out.fit, treat = "MF.g", mediator = "GP.g",  :
  groups do not match between mediator and outcome models


Any help is welcome ... Thanks a ton
Raj

-- 
Shivraj Kanungo
*http://home.gwu.edu/~kanungo <http://home.gwu.edu/~kanungo>*
Department of Decision Sciences
The George Washington University
Funger Hall 415E, 2201 G St NW
Washington, DC 20052
(202) 994 3734 (Office)
(202) 994 2736 (Fax)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20160927/5f7a1d72/attachment.html>


More information about the Mediation-information mailing list