<div dir="ltr">Hi Raj, <div><br></div><div>I think the error is coming from a data problem. We need to create different data sets when analyzing a 2-2-1 model. Please refer our JSS paper (p.19) to deal with this problem. </div><div><br></div><div><a href="http://imai.princeton.edu/research/files/mediationR2.pdf#search='JSS+mediation">http://imai.princeton.edu/research/files/mediationR2.pdf#search='JSS+mediation</a>'<br></div><div><br></div><div>Best,</div><div>Kentaro </div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-28 10:48 GMT+09:00 Shivraj Kanungo <span dir="ltr"><<a href="mailto:kanungo@gwu.edu" target="_blank">kanungo@gwu.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Here is my setup for a 2-2-1 multilevel mediation model<div><br><div><div><font face="monospace, monospace"># ==============================<wbr>==============================<wbr>=============</font></div><div><font face="monospace, monospace"># 2-2-1 mediation</font></div><div><font face="monospace, monospace"># ==============================<wbr>==============================<wbr>=============</font></div><div><font face="monospace, monospace">med.fit <- lm(GP.g ~ MF.g + TE.g + size, data = dat_simple)</font></div><div><font face="monospace, monospace">out.fit <- lmer(IP ~ MF.g + GP.g + TE.g + size + (1|gId), data = dat_simple)</font></div><div><font face="monospace, monospace">med.out <- mediate(med.fit, out.fit, treat = "MF.g", mediator = "GP.g", </font></div><div><font face="monospace, monospace"> control.value = 3, treat.value = 4, sims = 100)</font></div><div><font face="monospace, monospace">summary(med.out)</font></div><div><br></div><div><br></div><div>and here is the output (I searched the web and could not find this error)</div><div><br></div><div><div><font face="monospace, monospace">> med.fit <- lm(GP.g ~ MF.g + TE.g + size, data = dat_simple)</font></div><div><font face="monospace, monospace">> out.fit <- lmer(IP ~ MF.g + GP.g + TE.g + size + sex + (1|gId), data = dat_simple)</font></div><div><font face="monospace, monospace">> med.out <- mediate(med.fit, out.fit, treat = "MF.g", mediator = "GP.g", </font></div><div><font face="monospace, monospace">+ sims = 100)</font></div><div><font face="monospace, monospace" color="#ff0000">Error in mediate(med.fit, out.fit, treat = "MF.g", mediator = "GP.g", : </font></div><div><font face="monospace, monospace" color="#ff0000"> groups do not match between mediator and outcome models</font></div></div><div><br></div><div><br></div>Any help is welcome ... Thanks a ton</div><div>Raj<span class="HOEnZb"><font color="#888888"><br><div><br><div>-- <br>Shivraj Kanungo<br><font color="#000099" face="'courier new', monospace"><b><a href="http://home.gwu.edu/~kanungo" target="_blank">http://home.gwu.edu/~kanungo</a></b></font><br>Department of Decision Sciences<br>The George Washington University <br>Funger Hall 415E, 2201 G St NW<br>Washington, DC 20052<br><a href="tel:%28202%29%20994%203734" value="+12029943734" target="_blank">(202) 994 3734</a> (Office) <br><a href="tel:%28202%29%20994%202736" value="+12029942736" target="_blank">(202) 994 2736</a> (Fax)</div></div>
</font></span></div></div></div>
<br>______________________________<wbr>_________________<br>
Mediation-information mailing list<br>
<a href="mailto:Mediation-information@lists.r-forge.r-project.org">Mediation-information@lists.r-<wbr>forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/mediation-information" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/mediation-information</a><br></blockquote></div><br></div>