seananderson / glmm-course

Workshop exercises on regression, GLMs, mixed-effects models, and GLMMs in R
172 stars 66 forks source link

fix plots; ggeffects::ggpredict() full.data arg is deprecated #18

Closed jdunic closed 3 years ago

jdunic commented 3 years ago

I get the following error when plotting the model predictions with simulated observed values

ggeffects::ggpredict(m_poisson, "x", full.data = TRUE) %>%
   ggplot(aes(x, predicted)) +
   geom_line(colour = "red") + 
   geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .2) +
   geom_point(aes(y = observed))
Error in FUN(X[[i]], ...) : object 'observed' not found

Here is a possible fix

seananderson commented 3 years ago

Thanks Jillian!