diagnose: Graphically diagnose model residuals.

View source: R/diagnose.R

diagnoseR Documentation

Graphically diagnose model residuals.

Description

Graphically diagnose model residuals.

Usage

diagnosemodel, fit_type = 'response', residual_type = 'response', point_color = 'black', line_color = 'black', pch = 1, lwd = 1)

Arguments

model

An lm, glm, or nls object.

fit_type

String. Default is "response". Type of fitted values to use based on options in predict().

residual_type

String. Default is "response". Type of residuals values to use based on options in resid().

point_color

Color of the points and fill color of the histograms. If left to defaults, fill of the histogram is white.

line_color

Color of the smoothed line.

pch

Point type. Same settings as Base R pch in plot().

lwd

Width of the smoothed line.

Value

2x2 charts similar to plot(model.lm): 2 scatter plots and 2 histograms of residuals and residuals

See Also

https://github.com/robertschnitman/diagnoser

Examples


# OLS case
model.lm <- lm(data = mtcars, formula = mpg ~ wt + gear)
diagnose(model.lm) # defaults
diagnose(model.lm, point_color = '#00BFC4', line_color = '#F8766D', pch = 16, lwd = 2)

# NLS case
model.nls <- nls(Ozone ~ theta0 + Temp^theta1, airquality)
diagnose(model.nls)


robertschnitman/schnitr documentation built on Aug. 18, 2022, 8:39 p.m.