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

lmuni(.data, dependent, explanatory, weights = "", ...)

Arguments

.data

Dataframe.

dependent

Character vector of length 1, name of depdendent variable (must be continuous vector).

explanatory

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

weights

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.

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.

See also

fit2df

Other finalfit model wrappers: coxphmulti(), coxphuni(), crrmulti(), crruni(), glmmixed(), glmmulti_boot(), glmmulti(), glmuni(), lmmixed(), lmmulti(), svyglmmulti(), svyglmuni()

Examples

library(finalfit)
library(dplyr)

explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "nodes"

colon_s %>%
  lmuni(dependent, explanatory) %>%
  fit2df()
#>             explanatory                     Coefficient
#> 1 age.factor40-59 years -1.14 (-2.08 to -0.21, p=0.016)
#> 2   age.factor60+ years -1.19 (-2.10 to -0.28, p=0.010)
#> 3        sex.factorMale  -0.14 (-0.60 to 0.33, p=0.565)
#> 4    obstruct.factorYes  -0.24 (-0.83 to 0.36, p=0.435)
#> 5      perfor.factorYes   0.24 (-1.13 to 1.61, p=0.735)