visualise_residuals: Visualise the Residuals of given a given Linear Model.

Description Usage Arguments Value See Also Examples

Description

Plots appropriate visualisations for the residuals of a given dataset. This function utilises ggplot2 to design and plot the Visualisations. The plots a histogram of the residuals. Plots a scatterplot for residuals and fitted values or predictors. Plots a qqplot to access the normality assumptions.. The plots are outputed as a list. The plots can also be saved to a specified directory. FUTURE NOTE: CONVERT THIS INTO A RESIDUAL ANALYSIS FUNCTION

Usage

1
2
visualise_residuals(model, plots = c("Res Hist", "Res vs. Fits",
  "Res vs. Pred", "Res QQplot"), directory = NULL)

Arguments

model

A linear model of type lm()

plots

A character object specifying the type of residual plot to return. Either "Residual Hist", "Res vs. Fits", "Res vs. Pred", "QQplot". Default is "Residual Hist"

directory

A character object specifying the directory where the visualisations are saved as a .pdf file.

Value

Outputs a variety of bar charts or histograms

See Also

visualise_qqplot, visualise_variables_x, visualise_variables_xx

Examples

1
2
3
4
5
6
7
8
9
# Example Data
mod <- lm(data = iris, Sepal.Length~.)
# save the curretnt working directory
dir <- getwd()
# Visualise the residuals of the model
visualise_residuals(model = mod, plots = "Res Hist")
visualise_residuals(model = mod, plots = "Res vs. Fits", directory = dir)
visualise_residuals(model = mod, plots = "Res vs. Pred")
visualise_residuals(model = mod, plots = "Res QQplot", directory = dir)

oislen/BuenaVista documentation built on May 16, 2019, 8:12 p.m.