Open grasshoppermouse opened 3 years ago
This works fine with boot=F, but throws an error when boot=T. A real corner case, I admit:
library(mediation) #> mediation: Causal Mediation Analysis #> Version: 4.5.0 test <- function(f1, f2, boot){ mtcars$mpg <- mtcars$mpg/max(mtcars$mpg) m_med <- glm(f1, family=binomial, mtcars) m_out <- glm(f2, family=binomial, mtcars) mediate(m_med, m_out, treat = "wt", mediator = 'am', boot = boot) } x <- test('am ~ wt', 'mpg ~ wt + am', F) #> Warning in eval(family$initialize): non-integer #successes in a binomial glm! x <- test('am ~ wt', 'mpg ~ wt + am', T) #> Warning in eval(family$initialize): non-integer #successes in a binomial glm! #> Running nonparametric bootstrap #> Error in stats::model.frame(formula = f1, data = structure(list(am = c(1, : object 'f1' not found
Created on 2021-03-17 by the reprex package (v0.3.0)
I'm seeing the same with an lm model. created a new issue #32
Hi @grasshoppermouse, I'm having a similar issue. I wonder whether you have found any solutions? If yes, would you mind sharing it with us?
This works fine with boot=F, but throws an error when boot=T. A real corner case, I admit:
Created on 2021-03-17 by the reprex package (v0.3.0)