PlotCookD: Plot Cook's D values

View source: R/GLM_functions.R

PlotCookDR Documentation

Plot Cook's D values

Description

This function plots Cook's D values from a glm() model fit against the observation index, and highlights observations with values exceeding a recommended cutoff.

Usage

PlotCookD(x, id.n = 10)

Arguments

x

A glm() model fit object.

id.n

An integer specifying how many observations to label.

Details

=============================================================================

Fox (1997, p. 280) suggested a cutoff value for identifying observations with high Cook's D values in a GLM model. Plotting the Cook's D values against the observation number (row index) and highlighting the values that exceed the cutoff is a quick way to inspect a model fit.

Value

None. This produces a plot via ggplot().

References

Fox, J. (1997). Applied regression analysis, linear models, and related methods. Thousand Oaks, CA: Sage Publications.

See Also

CookDco for Cook's D cutoff.

Examples

 m1 <- glm(formula = vs ~ wt + disp, family = binomial, data = mtcars)
 PlotCookD(m1)


sjpierce/piercer documentation built on Dec. 30, 2024, 3:28 p.m.