jthaman / ciTools

An R Package for Quick Uncertainty Intervals
GNU General Public License v3.0
106 stars 9 forks source link

my_pred_full_glmer_response - possible to not have newdata argument? #46

Open YoJimboDurant opened 4 years ago

YoJimboDurant commented 4 years ago

Hi. When I try to run add_ci with a glmerMod, I get the following error:

Error in [.data.frame(fr, vars) : undefined columns selected

After tracing and running in debug, it seems the error is being thrown by a call to lme4::bootMer and the issue is in the newdata argument.

Would it be incorrect to change my_pred_fixed_glmer_linear to drop the newdata argument? When I changed the my_pred function in bootstrap_ci_glmermod from

function (fit, lvl) { predict(fit, newdata = ciTools_data$tb_temp, re.form = NULL, family = fit@resp$family$family, type = "response") }

to

my_pred = function (fit, lvl) { predict(fit, re.form = NULL, family = fit@resp$family$family, type = "response") }

it seems to work. Since the data are contained inside the glmerMod object I don't see any need to have the newdata argument.