Description Usage Arguments Value See Also Examples
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
1 2 | visualise_residuals(model, plots = c("Res Hist", "Res vs. Fits",
"Res vs. Pred", "Res QQplot"), directory = NULL)
|
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. |
Outputs a variety of bar charts or histograms
visualise_qqplot
, visualise_variables_x
, visualise_variables_xx
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.