if(requireNamespace("lme4")) { # for cbpp data
data("cbpp", package = "lme4")
# The default fitting method uses Firth's bias-corrected estimates
(gm.firth <- mhglm(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial,
control=mhglm.control(fit.method="firthglm.fit")))
# Using maximum likelihood estimates is less reliable
(gm.ml <- mhglm(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial,
control=mhglm.control(fit.method="glm.fit")))
}
Run the code above in your browser using DataLab