mod <- glm(cbind(y, n-y) ~ ldose, data = beetle,
family = binomial(link = "cloglog"))
invest(mod, y0 = 0.5)
While this does not:
test_fun <- function(){
dat <- beetle
glm(cbind(y, n-y) ~ ldose, data = dat,
family = binomial(link = "cloglog"))
}
mod <- test_fun()
invest(mod, y0 = 0.5)
It fails with:
Error in eval(object$call$data, envir = parent.frame()) :
object 'dat' not found
It seems like it is looking in the global env for the object that was used to generate the model.
This is problematic if you generate the model in functions or create the model on subset data that you don't keep around.
Instead I believe it should use mod$data if it needs to original data.
This works:
While this does not:
It fails with:
It seems like it is looking in the global env for the object that was used to generate the model. This is problematic if you generate the model in functions or create the model on subset data that you don't keep around.
Instead I believe it should use
mod$data
if it needs to original data.