plot.diag_lm: Create a specific diagnostic graphic for lm fits

Description Usage Arguments Details See Also Examples

View source: R/plot-diag-lm-glm.R

Description

ggplot is used to plot a specific diagnostic graphic. The choices are: residuals plot, leverage mesuare plot, Cook's distance plot and z variable plot (link function plot). See Details for more information.

Usage

1
2
## S3 method for class 'diag_lm'
plot(x, type = "residuals", ...)

Arguments

x

a tibble of class diag_lm.

type

a string specifying the graphic to be plotted. The available choices are 'residuals' (default), 'leverage', 'cook' and 'link'.

...

futher arguments.

Details

The graph created will depend on the class of the model object and choice of the type argument. For diag_lm class, the option "residuals" creates a residuals vs fitted values plot, the option "cook" creates a Cook's distance vs index plot, and the option "leverage" plots a leverage vs index plot.

For more information about the measures used to create the plots, see the diag_data function documentation.

See Also

Other glm diagnostic functions: diag_data, plot.diag_glm

Examples

1
2
3
4
5
fit_lm <- lm(mpg ~ qsec, data = mtcars)
diag_lm <- diag_data(fit_lm)
plot(diag_lm, type = "residuals")
plot(diag_lm, type = "leverage")
plot(diag_lm, type = "cook")

curso-r/ggilberto documentation built on May 20, 2019, 2:39 p.m.