lm_model {psycModel}R Documentation

Linear Regressions / ANOVA / ANCOVA

Description

[Stable]
Fit a linear regression using lm(). Linear regression is used to explore the effect of continuous variables / categorical variables in predicting a normally-distributed continuous variables.

Usage

lm_model(
  data,
  response_variable,
  predictor_variable,
  two_way_interaction_factor = NULL,
  three_way_interaction_factor = NULL,
  quite = FALSE
)

Arguments

data

data.frame

response_variable

response variable. Support dplyr::select() syntax.

predictor_variable

predictor variable. Support dplyr::select() syntax. It will automatically remove the response variable from predictor variable, so you can use contains() or start_with() safely.

two_way_interaction_factor

two-way interaction factors. You need to pass 2+ factor. Support dplyr::select() syntax.

three_way_interaction_factor

three-way interaction factor. You need to pass exactly 3 factors. Specifying three-way interaction factors automatically included all two-way interactions, so please do not specify the two_way_interaction_factor argument. Support dplyr::select() syntax.

quite

suppress printing output

Value

an object class of lm representing the linear regression fit

Examples

fit <- lm_model(
  data = iris,
  response_variable = Sepal.Length,
  predictor_variable = dplyr::everything(),
  two_way_interaction_factor = c(Sepal.Width, Species)
)

[Package psycModel version 0.5.0 Index]