[Mediation-information] Independent dummy variable coding
Heymans, M.W.
mw.heymans at vumc.nl
Thu Jan 26 16:18:38 CET 2012
Dear list,
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)
# Model 1
a <- glm(indep ~ dummy1 + dummy2, data=x, family=gaussian)
b <- glm(mediator ~ dummy1 + dummy2, data=x, family=gaussian)
c <- glm(indep outcome~ dummy1 + dummy2 + mediator, data=x, family=gaussian)
a
b
c
med1.boot <- mediate(b, c, boot=TRUE, sims=1000, treat=c("dummy1", "dummy2"), mediator="mediator")
summary(med1.boot)
Thanks for the response.
kind regards,
Martijn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20120126/8a71821c/attachment.htm>
More information about the Mediation-information
mailing list