pbreheny / visreg

Visualization of regression functions
http://pbreheny.github.io/visreg/
61 stars 18 forks source link

Error when lme4 model contains offset #54

Closed pbreheny closed 6 years ago

pbreheny commented 6 years ago

The following code

Data <- data.frame(x = rnorm(100),
                   y = rbinom(100, 1, 0.5),
                   A = LETTERS[1:2][rbinom(100, 1, 0.5)+1],
                   z = rep(1, 100))
require(lme4)
fit <- glmer(y ~ 0 + x + offset(z) + (1|A), family=binomial, data=Data)
visreg(fit, 'x')

Throws the error

Error in eval(inp, data, env) : object 'z' not found