compare_predictors: Fit linear models for a set of predictors to compare their...

compare_predictorsR Documentation

Fit linear models for a set of predictors to compare their effects alone and together

Description

This function fits a set of linear models to the data, where each model includes only one predictor. It then fits a full model with all predictors. The function returns a data frame with the coefficients for each model, as well as the full model.

Usage

compare_predictors(data, outcome, predictors, conf.level = 0.95)

Arguments

data

The data frame to use

outcome

The name of the outcome variable. Must be numeric.

predictors

A character vector of predictors to use.

conf.level

The confidence level to use. Default is .95.

Value

A data frame with the coefficients for each model

Examples

compare_predictors(iris, names(iris)[1], names(iris)[-1])
compare_predictors(mpg, names(mpg)[3], names(mpg)[-3])

Deleetdk/kirkegaard documentation built on April 27, 2024, 3:26 p.m.