finalfit
model
wrapperR/glmmulti.R
glmmulti.Rd
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", ...)
.data | Data frame. |
---|---|
dependent | Character vector of length 1: name of depdendent 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 |
... | Other arguments to pass to |
A multivariable glm
fitted model.
Uses glm
with finalfit
modelling conventions.
Output can be passed to fit2df
.
Other finalfit model wrappers:
coxphmulti()
,
coxphuni()
,
crrmulti()
,
crruni()
,
glmmixed()
,
glmmulti_boot()
,
glmuni()
,
lmmixed()
,
lmmulti()
,
lmuni()
,
svyglmmulti()
,
svyglmuni()
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)")#>#> 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)