Using finalfit conventions, produces a multivariable binomial logistic regression model for a set of explanatory variables against a binary dependent.

glmmulti(.data, dependent, explanatory, family = "binomial", weights = "", ...)

Arguments

.data

Data frame.

dependent

Character vector of length 1: name of dependent variable (must have 2 levels).

explanatory

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

family

Character vector quoted or unquoted of the error distribution and link function to be used in the model, see glm.

weights

Character vector of length 1: name of variabe for weighting. 'Prior weights' to be used in the fitting process.

...

Other arguments to pass to glm.

Value

A multivariable glm fitted model.

Details

Uses glm with finalfit modelling conventions. Output can be passed to fit2df.

See also

fit2df, finalfit_merge

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

Examples

library(finalfit)
library(dplyr)
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "mort_5yr"

colon_s %>%
  glmmulti(dependent, explanatory) %>%
  fit2df(estimate_suffix=" (multivariable)")
#> Waiting for profiling to be done...
#>             explanatory        OR (multivariable)
#> 1 age.factor40-59 years 0.57 (0.34-0.98, p=0.041)
#> 2   age.factor60+ years 0.81 (0.48-1.36, p=0.426)
#> 3        sex.factorMale 0.98 (0.75-1.28, p=0.902)
#> 4    obstruct.factorYes 1.25 (0.90-1.76, p=0.186)
#> 5      perfor.factorYes 1.12 (0.51-2.44, p=0.770)