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

glmmulti(.data, dependent, explanatory)

Arguments

.data

Dataframe.

dependent

Character vector usually of length 1, but can take more than 1 dependent: name of depdendent variable (must have 2 levels).

explanatory

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

Value

A list of multivariable glm fitted model outputs. Output is of class glmlist.

Details

Uses glm with finalfit modelling conventions. Output can be passed to fit2df. Note that this function can take multiple dependent variables as well, but performs multiple individual models, not a multivariate analysis.

See also

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=" (univariable)")
#> Waiting for profiling to be done...
#> explanatory OR (univariable) #> 2 age.factor40-59 years 0.57 (0.34-0.98, p=0.041) #> 3 age.factor60+ years 0.81 (0.48-1.36, p=0.426) #> 4 sex.factorMale 0.98 (0.75-1.28, p=0.902) #> 5 obstruct.factorYes 1.25 (0.90-1.76, p=0.186) #> 6 perfor.factorYes 1.12 (0.51-2.44, p=0.770)