finalfit conventions, produces multiple multivariable linear
regression models for a set of explanatory variables against a continuous dependent.
lmmulti(.data, dependent, explanatory)
Character vector usually of length 1, but can take more than 1 dependent: name of depdendent variable (must a continuous vector).
Character vector of any length: name(s) of explanatory variables.
A list of multivariable
lm fitted model outputs.
Output is of class
finalfit modelling conventions. Output can be
fit2df. Note that this function can take multiple
variables as well, but performs multiple individual models, not a multivariate analysis.
library(finalfit) library(dplyr) explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") dependent = "nodes" colon_s %>% lmmulti(dependent, explanatory) %>% fit2df()#> explanatory Coefficient #> 2 age.factor40-59 years -1.21 (-2.16 to -0.26, p=0.012) #> 3 age.factor60+ years -1.25 (-2.18 to -0.33, p=0.008) #> 4 sex.factorMale -0.07 (-0.54 to 0.40, p=0.779) #> 5 obstruct.factorYes -0.31 (-0.91 to 0.29, p=0.313) #> 6 perfor.factorYes 0.28 (-1.09 to 1.66, p=0.686)