regress: Compute linear regression

View source: R/regression.R

regressR Documentation

Compute linear regression

Description

Computes linear regression for all independent variables on the specified dependent variable. Linear modeling of multiple independent variables uses stepwise regression modeling. If specified, preconditions for (multi-)collinearity and for homoscedasticity are checked.

Usage

regress(
  data,
  dependent_var,
  ...,
  check_independenterrors = FALSE,
  check_multicollinearity = FALSE,
  check_homoscedasticity = FALSE
)

Arguments

data

a tibble or a tdcmm model

dependent_var

The dependent variable on which the linear model is fitted. Specify as column name.

...

Independent variables to take into account as (one or many) predictors for the dependent variable. Specify as column names. At least one has to be specified.

check_independenterrors

if set, the independence of errors among any two cases is being checked using a Durbin-Watson test

check_multicollinearity

if set, multicollinearity among all specified independent variables is being checked using the variance inflation factor (VIF) and the tolerance (1/VIF); this check can only be performed if at least two independent variables are provided, and all provided variables need to be numeric

check_homoscedasticity

if set, homoscedasticity is being checked using a Breusch-Pagan test

Value

a tdcmm model

Examples

WoJ %>% regress(autonomy_selection, ethics_1)
WoJ %>% regress(autonomy_selection, work_experience, trust_government)


joon-e/tidycomm documentation built on Feb. 24, 2024, 8:58 a.m.