best_lm_model: Best Linear Model

Description Usage Arguments Examples

Description

This function helps you select the best linear model given your dataset. Allows you to define a denpendent variable, any variables you wish to have in your final model and which type of optomized liner model you would like returned. Provides both Adjusted R^2 and p-value optimized models.

Usage

1
2
best_lm_model(data, dep_var = "", keep_vars = list(),
  ignore_vars = list(), return = "all")

Arguments

data

A data.frame() object which contains the data you wish to model.

dep_var

A string containing the dependent variable you wish your model to measure. Defaults to the first column of data.

keep_vars

A string, or list() of strings, which represents the variables you want to keep in your final model regardless of their effects on the final model's optimization.

ignore_vars

A string, or list() of strings, which represents the variables you want to exclude in your final model regardless of their effects on the final model's optimization.

return

A string object that represents the type of model you would like to return.

  • "base" returns a linear model of all of the variables through the obect model_base and a summary table of that model.

  • "r2" returns an Adjusted R^2 optimized linear model of the data through the obect model_r2 and a summary table of that model.

  • "p" returns a p-value optimized (95% signifigance) linear model of the data through the obect model_p and a summary table of that model.

  • "all" returns all of the above model objects and summary tables. return defaults to "all".

Examples

1
best_lm_model(swiss, dep_var="Fertility", keep_var="Catholic", return="p")

stuckinthe16th/best.model documentation built on May 5, 2019, 9:02 p.m.