[Mediation-information] (no subject)

Angel Rodriguez angel.rodriguez at matiainstituto.net
Fri Sep 19 13:15:47 CEST 2014


Dear Subscribers,
 
I've encountered the following error message. Edad_c is numeric. Estudic, sexo, deprinf and benvii are dichotomic. Regalf has three categories.
 
Any help would be very valuable.
 
Best regards,
 
Angel Rodriguez-Laso
 
> med.fit <- glm(estudic ~ edad_c + sexo + regalf + deprinf, family="binomial" ,data=child65)
> out.fit <- glm(benvii ~ edad_c + sexo + regalf + deprinf + estudic, family="binomial" ,data=child65)
> library("mediation")
Loading required package: MASS
Loading required package: Matrix
Loading required package: lpSolve
Loading required package: mvtnorm
mediation: Causal Mediation Analysis
Version: 4.4.2

> library("sandwich")
> set.seed(2014)
> med.out <- mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic", robustSE = TRUE, sims = 100)
Error in if (xhat == 0) out <- 1 else { : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic",  :
  treatment and control values do not match factor levels; using no and sí as control and treatment, respectively

________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20140919/b2954de8/attachment.html>


More information about the Mediation-information mailing list