finalfit model wrapperR/glmmultiboot.R
glmmulti_boot.RdUsing finalfit conventions, produces a multivariable binomial logistic
regression models for a set of explanatory variables against a binary
dependent.
glmmulti_boot(.data, dependent, explanatory, R = 1000)A multivariable glm fitted model with
bootstrapped confidence intervals. Output is of class glmboot.
Uses glm with finalfit modelling conventions.
boot::boot is used to draw bootstrapped confidence
intervals on fixed effect model coefficients. Output can be passed to
fit2df.
library(finalfit)
library(dplyr)
## Note number of draws set to 100 just for speed in this example
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "mort_5yr"
colon_s %>%
glmmulti_boot(dependent, explanatory, R=100) %>%
fit2df(estimate_suffix="(multivariable (BS CIs))")
#> explanatory OR(multivariable (BS CIs))
#> 1 age.factor40-59 years 0.57 (0.35-0.91, p<0.001)
#> 2 age.factor60+ years 0.81 (0.44-1.31, p=0.520)
#> 3 sex.factorMale 0.98 (0.73-1.32, p=0.860)
#> 4 obstruct.factorYes 1.25 (0.88-1.78, p=0.080)
#> 5 perfor.factorYes 1.12 (0.35-2.69, p=0.760)