mediation icon indicating copy to clipboard operation
mediation copied to clipboard

Error in if (xhat == 0) out <- 1 else { : missing value where TRUE/FALSE needed

Open almogsi opened this issue 5 years ago • 10 comments

I'm having trouble with mediation::mediate()

nb.terror.y.anx <- glm(data = terror_removed2,
                   certain~cond + event + WC + anx,
                   control = glm.control(maxit = 50000),
                   family = "poisson")

nb.terror.m.anx <- glm(data = terror_removed2,
                   anx~cond + event + WC + certain,
                   control = glm.control(maxit = 50000),
                   family = "poisson")

med.anx <- mediation::mediate(nb.terror.m.anx,nb.terror.y.anx, treat = "cond", 
                              mediator = "anx", sim = 2)

Works fine, but whenever sim>2, I get:

Error in if (xhat == 0) out <- 1 else { : 
  missing value where TRUE/FALSE needed

I saw there's still an open topic in a realted issue

Hope it's ok to flag it up again.

Thanks!

almogsi avatar Nov 10 '19 15:11 almogsi