plot.diag_glm: Create a specific diagnostic graphic for glm fit

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 section for more information.

Usage

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

Arguments

x

a tibble of class diag_glm.

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_glm class, the option "residuals" creates a residuals vs fitted values plot, the option "cook" creates a Cook's distance vs index plot, the option "leverage" creats a leverage vs fitted values plot, and the option "link" returns a z variable vs linear predictor 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_lm

Examples

1
2
3
4
5
6
fit_glm <- glm(mpg ~ qsec, family = Gamma(link = "log"), data = mtcars)
diag_glm <- diag_data(fit_glm)
plot(diag_glm)
plot(diag_glm, type = "leverage")
plot(diag_glm, type = "cook")
plot(diag_glm, type = "link")

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