Using finalfit conventions, produces multiple multivariable linear regression models for a set of explanatory variables against a continuous dependent.

lmmulti(.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 a continuous vector).

explanatory

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

...

Other arguments to pass to lm.

Value

A list of multivariable lm fitted model outputs. Output is of class lmlist.

Details

Uses lm 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 = "nodes" colon_s %>% lmmulti(dependent, explanatory) %>% fit2df()
#> explanatory Coefficient #> 1 age.factor40-59 years -1.21 (-2.16 to -0.26, p=0.012) #> 2 age.factor60+ years -1.25 (-2.18 to -0.33, p=0.008) #> 3 sex.factorMale -0.07 (-0.54 to 0.40, p=0.779) #> 4 obstruct.factorYes -0.31 (-0.91 to 0.29, p=0.313) #> 5 perfor.factorYes 0.28 (-1.09 to 1.66, p=0.686)