<HTML dir=ltr><HEAD><TITLE>RE: [Mediation-information] (no subject)</TITLE>
<META content="text/html; charset=unicode" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 11.00.9600.17280"></HEAD>
<BODY>
<DIV id=idOWAReplyText34767 dir=ltr>
<DIV dir=ltr><FONT color=#000000 size=2 face=Arial>Thank you very much. Should I attach them to a message?</FONT></DIV>
<DIV dir=ltr><FONT size=2 face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT size=2 face=Arial>Angel</FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>De:</B> Kentaro Hirose [mailto:hirose@Princeton.EDU]<BR><B>Enviado el:</B> vie 19/09/2014 14:33<BR><B>Para:</B> Angel Rodriguez; mediation-information@r-forge.wu-wien.ac.at<BR><B>Asunto:</B> RE: [Mediation-information] (no subject)<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>I guess it's somehow related to the data you're using. I'll figure out the problem if you send me a small subset of your data and code.<BR><BR><BR>Best,<BR>Kentaro<BR><BR><BR>________________________________________<BR>From: Angel Rodriguez [angel.rodriguez@matiainstituto.net]<BR>Sent: Friday, September 19, 2014 8:22 AM<BR>To: Kentaro Hirose; mediation-information@r-forge.wu-wien.ac.at<BR>Subject: RE: [Mediation-information] (no subject)<BR><BR>Thank you, Kentaro. The treatment variable has two values only. With your command that warning disappears but, what about the error:<BR><BR>Error in if (xhat == 0) out <- 1 else { :<BR> missing value where TRUE/FALSE needed<BR><BR>?<BR>Angel<BR><BR><BR><BR>________________________________<BR>De: mediation-information-bounces@lists.r-forge.r-project.org en nombre de Kentaro Hirose<BR>Enviado el: vie 19/09/2014 14:17<BR>Para: mediation-information@r-forge.wu-wien.ac.at<BR>Asunto: Re: [Mediation-information] (no subject)<BR><BR><BR>Hi Angel,<BR><BR>The warning message "treatment and control values do not match factor levels" pops up when your treatment has more than two values but you don't specify the specific values of the treatment that you're interested when deriving the treatment effect. So, for example, if you're interested in the treatment effect when the value of the treatment changes from no to si, then you should use the following command:<BR><BR>med.out <- mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic", robustSE = TRUE, sims = 100, control.value = "no", treat.value = "si")<BR><BR><BR>Best,<BR>Kentaro<BR><BR><BR><BR>________________________________________<BR>From: mediation-information-bounces@r-forge.wu-wien.ac.at [mediation-information-bounces@r-forge.wu-wien.ac.at] on behalf of Angel Rodriguez [angel.rodriguez@matiainstituto.net]<BR>Sent: Friday, September 19, 2014 7:15 AM<BR>To: mediation-information@r-forge.wu-wien.ac.at<BR>Subject: Re: [Mediation-information] (no subject)<BR><BR>Dear Subscribers,<BR><BR>I've encountered the following error message. Edad_c is numeric. Estudic, sexo, deprinf and benvii are dichotomic. Regalf has three categories.<BR><BR>Any help would be very valuable.<BR><BR>Best regards,<BR><BR>Angel Rodriguez-Laso<BR><BR><BR>> med.fit <- glm(estudic ~ edad_c + sexo + regalf + deprinf, family="binomial" ,data=child65)<BR>> out.fit <- glm(benvii ~ edad_c + sexo + regalf + deprinf + estudic, family="binomial" ,data=child65)<BR>> library("mediation")<BR>Loading required package: MASS<BR>Loading required package: Matrix<BR>Loading required package: lpSolve<BR>Loading required package: mvtnorm<BR>mediation: Causal Mediation Analysis<BR>Version: 4.4.2<BR><BR>> library("sandwich")<BR>> set.seed(2014)<BR>> med.out <- mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic", robustSE = TRUE, sims = 100)<BR>Error in if (xhat == 0) out <- 1 else { :<BR> missing value where TRUE/FALSE needed<BR>In addition: Warning message:<BR>In mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic", :<BR> treatment and control values do not match factor levels; using no and sí as control and treatment, respectively<BR><BR>________________________________<BR>_______________________________________________<BR>Mediation-information mailing list<BR>Mediation-information@lists.r-forge.r-project.org<BR><A href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/mediation-information">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/mediation-information</A><BR><BR></FONT></P></DIV></BODY></HTML>