Using finalfit conventions, produces mixed effects binomial logistic regression models for a set of explanatory variables against a binary dependent.

glmmixed(.data, dependent, explanatory, random_effect, ...)





Character vector of length 1, name of depdendent variable (must have 2 levels).


Character vector of any length: name(s) of explanatory variables.


Character vector of length 1, either, (1) name of random intercept variable, e.g. "var1", (automatically convered to "(1 | var1)"); or, (2) the full lme4 specification, e.g. "(var1 | var2)". Note parenthesis MUST be included in (2) but NOT included in (1).


Other arguments to pass to lme4::glmer.


A list of multivariable lme4::glmer fitted model outputs. Output is of class glmerMod.


Uses lme4::glmer with finalfit modelling conventions. Output can be passed to fit2df. This is only currently set-up to take a single random effect as a random intercept. Can be updated in future to allow multiple random intercepts, random gradients and interactions on random effects if there is a need

See also

fit2df, finalfit_merge

Other finalfit model wrappers: coxphmulti(), coxphuni(), crrmulti(), crruni(), glmmulti_boot(), glmmulti(), glmuni(), lmmixed(), lmmulti(), lmuni(), svyglmmulti(), svyglmuni()


library(finalfit) library(dplyr) explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") random_effect = "hospital" dependent = "mort_5yr" colon_s %>% glmmixed(dependent, explanatory, random_effect) %>% fit2df(estimate_suffix=" (multilevel)")
#> explanatory OR (multilevel) #> 1 age.factor40-59 years 0.75 (0.39-1.44, p=0.382) #> 2 age.factor60+ years 1.03 (0.55-1.96, p=0.916) #> 3 sex.factorMale 0.80 (0.58-1.11, p=0.180) #> 4 obstruct.factorYes 1.23 (0.82-1.83, p=0.320) #> 5 perfor.factorYes 1.03 (0.43-2.51, p=0.940)