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

lmmulti(.data, dependent, explanatory, ...)

Arguments

.data

Dataframe.

dependent

Character vector of length 1: 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 multivariable lm fitted model.

Details

Uses lm with finalfit modelling conventions. Output can be passed to fit2df.

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)