<div dir="ltr"><div>*THIS WAS THE RESPONSE TO ANGEL*</div><div><br></div><br>Hi Angel,<br><br> You have to change the mediator into number like 0 and 1.<br><br> ---------------------------------------------------------------------------<br> library("mediation")<br> library("sandwich")<br> set.seed(2014)<br><br> load("~/Desktop/kentaro.rda")<br><br> kentaro$estudic.new <- 0<br> kentaro$estudic.new[kentaro$estudic == "Menos que primarios"] <- 1<br> kentaro$estudic <- kentaro$estudic.new<br><br> med.fit <- glm(estudic ~ edad_c + sexo + regalf + deprinf, family="binomial" ,data=kentaro)<br> out.fit <- glm(benvii ~ edad_c + sexo + regalf + deprinf + estudic, family="binomial" ,data=kentaro)<br><br> med.out <- mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic", robustSE = TRUE, sims = 100, control.value = "no", treat.value = "s\xed")<br> summary(med.out)<br> ---------------------------------------------------------------------------<br><br> Best,<br> Kentaro<br><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dustin Tingley<div>Professor of Government<br>Government Department<br>Harvard University<br><a href="http://scholar.harvard.edu/dtingley" target="_blank">Webpage</a><br><div><br></div><div>Director of Graduate Studies, Government Department</div><div>Faculty Director, <a href="http://vpal.harvard.edu/research" target="_blank">Vice Provost on Advances in Learning (VPAL) Research Team</a></div><div>Director, <a href="http://projects.iq.harvard.edu/peblss/" target="_blank">Program on Experience Based Learning in the Social Sciences</a><div>Faculty Founder and Director, <a href="http://ablconnect.harvard.edu/" target="_blank">ABLConnect</a>, the Active and Activity Based Learning Connection<br></div></div><div>Director, <a href="http://urs.iq.harvard.edu/" target="_blank">Undergraduate Research Scholars</a>, Institute of Quantitative Social Science<br></div><div><div><div>         -Contribute to the <a href="http://urs.iq.harvard.edu/pages/research-resources" target="_blank">Research Resource Reservoir</a><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Feb 8, 2016 at 6:25 AM, L.R.A. Schouten <span dir="ltr"><<a href="mailto:l.r.schouten@amc.uva.nl" target="_blank">l.r.schouten@amc.uva.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="NL" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US">Dear Angel,<u></u><u></u></span></p>
<pre style="word-break:break-all"><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri","sans-serif"">I read your question on <a href="http://lists.r-forge.r-project.org/" target="_blank">http://lists.r-forge.r-project.org/</a> about the error: <span style="color:#c5060b;background:#e1e2e5">Error in if (xhat == 0) out <- 1 else { :   missing value where TRUE/FALSE needed I get the same error when using </span><span style="color:black;background:#e1e2e5"><u></u><u></u></span></span></pre>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I got the same error using the code:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">med.fit<-glm(formula = cluster_two~Tertile_age, data=cluster, family=binomial)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">out.fit<-glm(formula = death ~cluster_two+Tertile_age, data=cluster, family=binomial)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Did you figure out what causes the error.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thank you in advance!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Laura <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Laura Schouten MD | Phd candidate Pediatric Intensive Care | Department of intensive care & Laboratory of Experimental Intensive
 Care and Anesthesiology (LEICA) | Room G3-227 Emma Children's Hospital | Academic Medical Center | Meibergdreef 9, 1105 AZ Amsterdam | E:
</span><span><a href="mailto:l.r.schouten@amc.nl" target="_blank"><span lang="EN-US" style="color:blue">l.r.schouten@amc.nl</span></a></span><span lang="EN-US"> | T: 020 5666342 | m:<a href="tel:%2B31641149755" value="+31641149755" target="_blank">+31641149755</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div style="font-size:9pt;font-family:'Calibri',sans-serif">
<p style="font-size:8pt;line-height:4pt;font-family:'Arial','times roman',serif">
</p>
<hr>
<p style="text-align:center">AMC Disclaimer : <a href="https://www.amc.nl/disclaimer" target="_blank">https://www.amc.nl/disclaimer</a></p>
<hr>
<p style="font-size:8pt;line-height:4pt;font-family:'Arial','times roman',serif">
</p>
</div>
</div>

<br>_______________________________________________<br>
Mediation-information mailing list<br>
<a href="mailto:Mediation-information@lists.r-forge.r-project.org">Mediation-information@lists.r-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-project.org/cgi-bin/mailman/listinfo/mediation-information</a><br></blockquote></div><br></div>