Using finalfit conventions, produces a multivariable linear regression
model for a set of explanatory variables against a continuous dependent.
lmmulti(.data, dependent, explanatory, weights = "", ...)Dataframe.
Character vector of length 1: name of depdendent variable (must a continuous vector).
Character vector of any length: name(s) of explanatory variables.
Character vector of length 1: name of variabe for weighting. 'Prior weights' to be used in the fitting process.
Other arguments to pass to lm.
A multivariable lm fitted model.
Other finalfit model wrappers:
coxphmulti(),
coxphuni(),
crrmulti(),
crruni(),
glmmixed(),
glmmulti(),
glmmulti_boot(),
glmuni(),
lmmixed(),
lmuni(),
svyglmmulti(),
svyglmuni()
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)