<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body fPStyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<p>Dear list,</p>
<p>&nbsp;</p>
<p>Is it possible to do a mediation analysis in combination with an independent categorical (dummy)variable, something like this? How to calculate the mediation effect with respect to both dummy variables? Just include dummy1 first andf than dummy2 in model
 c? I tried it with real data but the code below does not work? What is wrong? (define the variable as factor also does not solve it)</p>
<p>&nbsp;</p>
<p><font face="Courier New"># Model 1<br>
a &lt;- glm(indep ~ dummy1 &#43; dummy2, data=x, family=gaussian) <br>
b &lt;- glm(mediator ~ dummy1 &#43; dummy2, data=x, family=gaussian)<br>
c &lt;- glm(indep outcome~ dummy1 &#43; dummy2 &#43; mediator, data=x, family=gaussian)</font></p>
<p><font face="Courier New">a<br>
b <br>
c<br>
<br>
med1.boot &lt;- mediate(b, c, boot=TRUE, sims=1000, treat=c(&quot;dummy1&quot;, &quot;dummy2&quot;), mediator=&quot;mediator&quot;)<br>
summary(med1.boot)</font></p>
<p><font face="Courier New"></font>&nbsp;</p>
<p><font face="Courier New">Thanks for the response.</font></p>
<p><font face="Courier New"></font>&nbsp;</p>
<p><font face="Courier New">kind regards,</font></p>
<p><font face="Courier New"></font>&nbsp;</p>
<p><font face="Courier New">Martijn</font></p>
<p><font face="Courier New"></font>&nbsp;</p>
</div>
</body>
</html>