R/e_plot_lm_diagnostics.R
e_plot_lm_diagnostics.Rd
Plotting residual diagnostics for an lm() object.
linear model object returned by lm()
number of rows and columns for the graphic plot, default is c(1, 3); use "NA" for a single plot with 3 columns
default plot numbers for lm()
number to identify in plots from lm() and qqPlot()
T/F for whether to show the QQ-plot
T/F for whether to show Box-Cox transformation
T/F for whether to assess constant variance
T/F for whether to assess multicollinearity between predictor variables
T/F for whether to show residuals by order of data
T/F for whether to show added-variables plot
NULL to accept other plot options, or "simple" to exclude boxcox, constant var, collinearity, order of data, and added-variable plots. "simpleAV" to add back in the added-variable plots. "all" includes all possible plots in this function.
NULL, invisibly
fit <- lm(mpg ~ cyl + disp + hp + gear, data = dat_mtcars_e)
e_plot_lm_diagnostics(fit)
#> Non-constant Variance Score Test
#> Variance formula: ~ fitted.values
#> Chisquare = 2.67906, Df = 1, p = 0.10168
#> Warning: Note: Collinearity plot unreliable for predictors that also have interactions in the model.
mod <- stats::formula(mpg ~ cyl + disp + hp + gear)
fit <- lm(mod, data = dat_mtcars_e)
e_plot_lm_diagnostics(fit)
#> Error in stats::model.frame(formula = mod, data = dat_mtcars_e, drop.unused.levels = TRUE) :
#> object 'mod' not found
#> Non-constant Variance Score Test
#> Variance formula: ~ fitted.values
#> Chisquare = 2.67906, Df = 1, p = 0.10168
#> Warning: Note: Collinearity plot unreliable for predictors that also have interactions in the model.