uni_bi_dist: Assessment of Normality and Linearity in Linear Regression

View source: R/uni_bi_dist.R

uni_bi_distR Documentation

Assessment of Normality and Linearity in Linear Regression

Description

This function is to examine normality and linearity of a linear regression in the form of histograms of your predictor and your outcome as well as a scatterplot of these variables.

Usage

uni_bi_dist(
  data,
  x,
  y,
  alpha,
  bins,
  fill,
  color,
  loess_color,
  line_color,
  se = c(TRUE, FALSE),
  size
)

Arguments

data

The data frame that includes the variables you are interested in examining in a linear regression.

x

The X variable you'd like to examine.

y

Your outcome of interest.

alpha

Value to determine how transparent you'd like your histograms and points in the scatterplot.

bins

Value to adjust the bins of your histogram.

fill

Value to determine the color you'd like your histogram to be filled with. The outline of the histograms is set to "White"

color

Value to determine what color you'd like your points to be in the scatterplot (e.g., "blue", "#6a1f25")

loess_color

value to determine what color you'd like your loess line to be in the scatterplot (e.g., "blue", "#6a1f25")

line_color

value to determine what color you'd like your linear relationship to be in the scatterplot (e.g., "blue", "#6a1f25")

se

A logical vector to decide if you'd like to include the standard error of both the loess and linear relationships in your scatterplot.

size

Value to decide if you'd like your lines to be thinner or thicker in your scatterplot

Value

Returns three ggplot2 visuals. Two histograms of your variables of interest and a scatterplot of the relationship.

Examples


uni_bi_dist(data = mtcars, x = hp, y = mpg, alpha = .8, bins = 15, fill = "dodgerblue", color = "black", loess_color = "darkgreen", line_color = "green", se = FALSE, size = 1.25)

jpedroza1228/reg.diagnostics documentation built on June 15, 2022, 9:30 p.m.